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

|
网页之跑马灯文字特效
//修改宽度2 X( W) l! i, i, S3 b% V, I$ s
var marqueewidth=3007 Z- n8 V' t5 W, k; f9 O
//高度% u/ g/ c6 S3 S5 l( R4 v/ y$ ^
var marqueeheight=25
1 q. N$ b2 s: r. e9 f. O//速度(1-10)8 d! J0 }/ H6 A. b
var marqueespeed=3
* B' j# |3 \/ [//背景颜色" ?, }; y) U7 f4 \' k1 R
var marqueebgcolor="#FFFFFF"* b5 J9 L: h9 D6 x: x
//是否能暂停 (0=no. 1=yes)?4 A; Y% J) d. a( X3 V
var pauseit=1: d8 O0 o$ n9 t- ^+ j: K
7 ] G9 j! o6 Z& E/ p; S//修改显示内容
3 I3 H' R" y7 Q9 Q' y C! ]9 L# X+ Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 U5 W7 F& T3 z- q$ }
S7 \" g4 Q& K8 t P. x6 U: n& P x* V
////下面不需改变////////////
- H. [! C+ g4 u" P2 Q6 ~
9 m# a; C! ?: }! U5 R/ xvar copyspeed=marqueespeed+ L( B6 G& n6 y3 n- ^) I
var pausespeed=(pauseit==0)? copyspeed: 0: S' _, z; L) q1 B4 E# r
var iedom=document.all||document.getElementById3 M8 {, A; \, ~
if (iedom)
1 Z2 c% y8 e! u/ R# M& n2 b: Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 `, N* F% \1 nvar actualwidth=''; i, ]) S+ Y) q" \* q( x' a
var cross_marquee, ns_marquee( j9 Y3 Y. T5 [: `' A- ~
. \$ }3 f* K; ] ^
function populate(){+ G2 R8 {; C2 w2 k+ ?
if (iedom){: _% ]7 j0 X' r5 E% T- i$ s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( W3 L6 Z4 N% I; f/ n6 z, l8 V) d. ^cross_marquee.style.left=marqueewidth+84 n) g* |% K$ {3 a/ r
cross_marquee.innerHTML=marqueecontent
" X, c( [! B0 I6 factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) g: x' ^/ ^* z7 i% Z! ?
}- k' G# U# R& G5 ^ S ]2 K
else if (document.layers){
8 y0 O* F6 f3 I5 F7 z7 |ns_marquee=document.ns_marquee.document.ns_marquee2/ |. _7 K8 X/ }
ns_marquee.left=marqueewidth+8' e2 _% a$ d; q: u1 m2 q) t
ns_marquee.document.write(marqueecontent)
+ o, o$ ]. j1 {" G3 a# u- Cns_marquee.document.close()
( M- s- |7 j; Zactualwidth=ns_marquee.document.width& J6 ]/ }7 o0 Y' [: `. m5 O
}
7 H* C# {- @! y3 Hlefttime=setInterval("scrollmarquee()",20)
5 v& h9 j$ ~2 m- M& j+ I. i# B. r}
4 Y; w: f6 G9 }! F8 |( H8 U! h7 ^window.onload=populate! l& l% k( V7 R% J" C% A& B
2 n1 D# w: F- g5 u" v( t+ D6 bfunction scrollmarquee(){8 U" |+ x1 m# F) |
if (iedom){
6 R* A3 D2 p! s& r% g" c8 _2 kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 w9 \5 H% j' x, V3 U! r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 _' T/ ?5 ?& T- o0 q/ F$ Lelse3 J* Z2 v( w9 x E
cross_marquee.style.left=marqueewidth+82 i0 P: g9 b8 r4 f" k- q
. r% R/ O2 K c9 d, k$ r}
. X: k4 Z' X4 Xelse if (document.layers){
2 J1 q; y/ C& m" E- O* _% iif (ns_marquee.left>(actualwidth*(-1)+8))
/ |! k s$ n4 A/ nns_marquee.left-=copyspeed
* M; I6 U$ U2 w, g: Z* uelse
5 U4 a* E! \7 ~' D& u& L- X( R2 uns_marquee.left=marqueewidth+8! r( ?) T: j' s- x+ Q2 S
}7 t( W1 n+ s0 |0 ~0 v# ?
}
) |) c' X+ X7 |$ `7 r2 F2 J
4 R/ O$ z7 t- dif (iedom||document.layers){
. N1 U4 l! c' D! l9 Z/ Kwith (document){
1 v- K4 R( ~; p1 odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 X0 o" O' M7 P' K, @: y5 s
if (iedom){2 D# [/ S1 I2 l$ u, y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 R4 z8 X4 v! U
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') p& o" X. n" o* ^3 n. i
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 G* B; B6 _, V! p! z: [( ^ l. wwrite('</div>')
( ], F) G' F5 { L; n}
7 y" h# _5 K4 E9 p$ q' \% m8 Welse if (document.layers){
1 v% w- }: h5 M9 v& Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% C c t1 x3 w+ }' g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% }3 j. K. |5 W# E3 S1 Q% F6 rwrite('</ilayer>')6 j, u; V# l7 ]: u1 ]/ z
}
" b- P; ?7 O, x) M) H& t8 K3 ]' `document.write('</td></table>')6 H8 X7 y+ _. ?: p1 k
}
0 l$ N3 t1 w/ w1 J7 P% c}- T4 A. Z. _: x
</script> |
|