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

|
网页之跑马灯文字特效
//修改宽度
* I% y0 T7 X4 y# h. [; cvar marqueewidth=300$ }! |% P9 V: U& x7 A
//高度
1 E8 u3 E1 |: V$ mvar marqueeheight=25
, X" d; Y& E- p//速度(1-10)
9 Z' z8 ^- e$ f, ], ~" ivar marqueespeed=3
; Z' L. F( R+ \4 v( n# Q% o8 L//背景颜色
: h$ _; L/ O7 [9 c N8 l9 M. ^var marqueebgcolor="#FFFFFF"7 J6 t, M, P* X
//是否能暂停 (0=no. 1=yes)?4 z3 f3 y$ \0 h6 s' Q
var pauseit=1
F% V% k# I( l7 K& k
' s/ g h( d$ r& K( ?. z//修改显示内容
8 \+ ^! q1 O$ F" A8 ]" ~0 t" vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* I; A, S3 S M R u5 f) r
& o7 y( V- n4 d ^: S
* C. t3 I2 A+ Y/ y4 B" q5 s' Q////下面不需改变////////////
u6 Q5 I( d( T
( k, p& n/ E: J8 y# P kvar copyspeed=marqueespeed
( Y: C$ Q. \' C, E1 [1 ]var pausespeed=(pauseit==0)? copyspeed: 0
$ u- n) H/ S5 \/ fvar iedom=document.all||document.getElementById8 N$ s' ^8 o: |) y
if (iedom)/ A) S# {/ S2 Y# o q Y, D% ?
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 S! n& N9 `$ z- d5 O9 U6 h( Jvar actualwidth=''
0 r" E. Y) V8 H# ]7 `/ B& ?var cross_marquee, ns_marquee
/ H: \3 Q" O6 ]; [8 f1 g9 ?. m4 w4 Q9 D9 o
function populate(){" ?) z& D+ t- X) w3 }+ Q" W( a
if (iedom){
& B' R& l6 x* V/ bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 P- {* T/ P9 w. _9 A2 }- ^) d
cross_marquee.style.left=marqueewidth+8
* S4 G0 r- x/ N, l" D3 fcross_marquee.innerHTML=marqueecontent3 x" x& {0 | H+ }; b0 a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( V7 C/ F S" g}6 G0 @" v% }# Z2 R: q/ D7 |& t
else if (document.layers){, K: l w: z2 R
ns_marquee=document.ns_marquee.document.ns_marquee23 z& a& N7 v* M$ u2 }
ns_marquee.left=marqueewidth+89 O+ ~- \9 C" R/ e3 s7 c4 |
ns_marquee.document.write(marqueecontent)- E" w: E- h \) ?' `2 _. u
ns_marquee.document.close()8 z$ Y5 ?/ r; a& s4 T6 d! {8 l! L
actualwidth=ns_marquee.document.width3 w: s1 l8 D/ w/ P0 F4 ~
}
; h) {% |. k7 e3 z/ }lefttime=setInterval("scrollmarquee()",20)3 G: O) O) c. g4 ]- b( H' J! z
}
- A. ]' J" [4 M p5 Z, j( Mwindow.onload=populate0 j: \% S& l/ I
' ^# F' M W% Y$ P0 X2 f5 k& zfunction scrollmarquee(){% f+ I0 z5 k5 z+ S5 @
if (iedom){ `. T9 I h6 `! L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); }% g' _6 Y) d& a3 r4 J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 l( O; T! k/ p# ielse. G' @& y7 f6 h. c" G
cross_marquee.style.left=marqueewidth+8; e. h" H1 A' h5 o- q# I( V
4 F3 d& g _$ z% a; C}
1 t) U# e8 s) `; [) zelse if (document.layers){( A4 K) \! y3 P
if (ns_marquee.left>(actualwidth*(-1)+8))
! L, b' C6 v1 E: {) M1 Rns_marquee.left-=copyspeed
9 |, \6 O+ n0 G. ~else& r- y4 Y4 H9 A# s$ c5 y
ns_marquee.left=marqueewidth+84 } r. @9 i7 ]/ A4 W3 P
}% i7 m: E( J1 W. {) d
}
2 d& }, _1 a9 J/ [( M% {2 k/ n/ @, h! ?7 x7 Y
if (iedom||document.layers){; X. j( S; a8 n& Q* L0 ?; m$ \" j
with (document){
7 Q. a$ T) `5 K" _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), |8 D6 e% j) h
if (iedom){ |6 j: H1 V% \: z8 _' ^4 i) u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), ^! C7 g/ n1 c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! l0 \9 x# m# I0 { C* v3 T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" q$ w) I0 A: L
write('</div>')& U; V0 Y9 r0 f
}
* J/ ~) Z. D# o8 ]" felse if (document.layers){% h' F0 E9 U# o$ l0 Y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): C- K$ _' G' ^+ T6 {3 @% N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' ]* X; ~: J/ u' [# }7 c7 B/ N! Dwrite('</ilayer>')8 [) ~6 d: i* c) Z
}
4 ?7 q9 J3 R, [# B; q# T' |6 z6 H) qdocument.write('</td></table>')% ]8 K6 o! u( g4 s9 b7 _1 J
}' g2 o# V0 T5 [# z2 K" E$ K/ t* d8 H
}: K6 J6 d; Y! l7 G' I" g* a" U
</script> |
|