|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度/ M- L! |- O( L" ]: S% f
var marqueewidth=300! j: [- e! R" ~! H a0 v# W* n
//高度( L: k* S$ I. H4 m* ^
var marqueeheight=25& W3 F" Y6 o, T# k+ M* ~
//速度(1-10)) N( k+ p7 d5 S) b9 b
var marqueespeed=3
1 |. d5 c. |/ Y5 c8 n//背景颜色+ x- P% z" k, f
var marqueebgcolor="#FFFFFF"
0 c6 [; w \3 H. h8 K//是否能暂停 (0=no. 1=yes)?: W* |. G/ u1 [& W# x
var pauseit=1
& V9 F( }1 y! g* |" D7 y- o9 }+ g5 I% m3 y3 t( }1 c/ o. ]2 E
//修改显示内容
/ s. V) f! f/ Y9 l1 V2 [1 A& Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) M0 i& l" j! m& Y8 y2 J
( k! Q9 O1 q, }& y a$ e
7 @" f& B$ w3 q5 R* s4 f7 \1 t////下面不需改变////////////+ W! y$ H1 R5 A; ?1 h) ]
/ U$ B' @' r/ A. X+ U3 N: r# c( r# p
var copyspeed=marqueespeed
! p* a; U( \: `) F; ^0 N! s( D4 F& ovar pausespeed=(pauseit==0)? copyspeed: 0
5 Z% a3 p; t+ Z3 g* mvar iedom=document.all||document.getElementById
% \7 Z# j% N- I% vif (iedom) o' @/ l' D; ?0 [' v; Z- |5 ]$ y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 |$ s, Q0 p% p* l4 \" B
var actualwidth=''1 @! }5 S) G$ x1 K. F
var cross_marquee, ns_marquee5 j4 K+ P8 E8 |( p3 Q7 S1 j
; t) a8 ~3 }, f/ G4 T8 w3 R, vfunction populate(){0 @5 D5 C) r+ i* q: `' ]3 y) o8 m f
if (iedom){
3 q! c5 J. C( a$ j' gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! b8 y6 N& ?7 y& F- y, Ycross_marquee.style.left=marqueewidth+8
. L: {4 U! N2 @+ Kcross_marquee.innerHTML=marqueecontent
: y5 e( w ?8 ]7 V Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 g9 P* z( u8 @' _! K O}
3 b! ]0 P5 u: c! b6 h9 @, c" felse if (document.layers){2 b1 f' S* @4 h2 [5 L2 P9 N, [
ns_marquee=document.ns_marquee.document.ns_marquee2
7 b J3 j- k/ s6 j( T; uns_marquee.left=marqueewidth+8 \9 c, h+ B3 ~3 ~- c+ P: T! J+ o
ns_marquee.document.write(marqueecontent)
. ]2 O. e5 \! `& [ns_marquee.document.close()
0 |. S" k1 r% X5 \0 o, iactualwidth=ns_marquee.document.width
) y6 ~ K [) u, l7 v}
- w; t! ?) n5 F \1 ?0 A7 nlefttime=setInterval("scrollmarquee()",20)9 t! n* q8 [+ @2 y$ W% `
}" N# a0 f$ |. J
window.onload=populate
1 |8 \1 s1 C @7 y0 d0 m
) x0 O% [7 \3 S8 cfunction scrollmarquee(){" H+ B. o' [% p9 }: G5 r
if (iedom){
7 @+ ] B' N4 U* g( l# Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) D% p- j x$ O, |% s( d2 }2 H1 qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 }9 ]& g. N; q
else2 ]* O0 Q7 w D$ ^
cross_marquee.style.left=marqueewidth+8) o' G) \: q* m8 a& A: U- y
0 G' p9 G4 }' c8 f6 ^8 e: Z* U}
2 c4 s+ o0 ]) d+ Z8 Jelse if (document.layers){
/ N4 E& z& D3 ~' A9 X% k0 {if (ns_marquee.left>(actualwidth*(-1)+8))- a7 m6 k& @, G1 A; P) a! H1 D* G+ p
ns_marquee.left-=copyspeed" r+ M! J3 C8 L2 m0 k5 \- }
else" `: X) r% R( M# D4 T9 f
ns_marquee.left=marqueewidth+8( g" G" g7 U1 \* N4 j
} V! @+ q4 W" k7 h, w1 V% C
}, M) ]- _$ w3 H; r: A. J$ [
9 a! i8 |1 j( p5 {+ h+ Q# r) ^6 L
if (iedom||document.layers){
8 n4 l5 d' S. p1 }( \with (document){: l* K6 x3 z& ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 H& z4 D6 G T0 C# { c4 l
if (iedom){: o: E6 k/ b* A7 a% @- N, h" K, a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 b D% e8 b' p( F8 Y* e0 \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: R3 m8 l, O c* F, K' `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 v5 ^" h" X" R2 g/ B& C, hwrite('</div>')7 @$ W% f3 y K% h0 e* W
}5 ^8 M8 B, j/ M1 F5 m# W! R2 j5 F
else if (document.layers){
( ~. q0 M; Z$ y& M- iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ w4 p3 V: }2 m; Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, g7 Z8 U6 ^" ^8 q/ Dwrite('</ilayer>')
J( I* C$ s. [}0 q5 R r. N8 p: o. J0 N
document.write('</td></table>')
1 S6 P' j8 q# z0 U}
# k5 c) v. f- w( Y2 _+ h, p* F ~}! `3 ?. a1 _- O9 D7 v r, v
</script> |
|