返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 @% w5 o) g; Y2 o+ J! Xvar marqueewidth=300! m! H& J9 N" w. ]# u
//高度  B2 m4 U" T2 F% ^; g
var marqueeheight=25
& }. K+ c- @( u5 H- j6 g//速度(1-10)
) d# q; h, ~. G+ j% M8 X) J+ Nvar marqueespeed=3
- P2 t. i0 b8 ^//背景颜色; q4 Z& D  `0 F- {: p% k
var marqueebgcolor="#FFFFFF"# C! z; Y5 m: _9 }- N- ]0 @3 J
//是否能暂停 (0=no. 1=yes)?, D9 L! V" m5 V3 ^" j% \
var pauseit=1! X" Q3 k  |$ d
$ R' Y) ~6 U5 u# b( B) r+ Z) \
//修改显示内容* U" D. C+ _2 `: Y- m7 X3 ]  {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* o6 K% C' y0 [% W, B
. ]5 t: |* d: p1 K7 e, j/ _( ~) v- Z: |0 j! T
////下面不需改变////////////
2 D; }/ M' S- w4 t# q! F; A- z
5 [  }5 V" K  yvar copyspeed=marqueespeed/ I! n; |2 v( ?4 q
var pausespeed=(pauseit==0)? copyspeed: 0
8 b6 @0 j, ?0 s4 q  W2 Fvar iedom=document.all||document.getElementById
% ^" p. N; _/ k* i7 f3 Mif (iedom)/ W0 ]3 H# h" F2 W6 J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% u' _5 _- z. V0 |. M) P( n
var actualwidth=''
9 u  v. z3 j, @: @' M1 h  Svar cross_marquee, ns_marquee3 z) }( y5 N# M- |7 {* j( i

: y  ^) i$ e& n, H. lfunction populate(){) t) @- @# T! \4 Q- P; V
if (iedom){
8 m: p8 ^" g% w/ j1 ~, l$ tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 S# t; m, \( B0 T' O! S
cross_marquee.style.left=marqueewidth+8
3 F9 ~5 j: m7 W# b6 Icross_marquee.innerHTML=marqueecontent
) y/ P6 W; {: o. S( W  \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 G& T/ m) F: r  O9 Z# j}
/ O7 H# A& N  o6 U. Y) V/ \$ kelse if (document.layers){
+ G; M% ~; O( f' c. Hns_marquee=document.ns_marquee.document.ns_marquee23 I4 V  i0 F3 A( U2 y
ns_marquee.left=marqueewidth+8
% Q) g$ I7 d  X& fns_marquee.document.write(marqueecontent)8 F5 w) g, Z  @/ F4 N, ?, K: I
ns_marquee.document.close()
3 q' Q- \( T* k) sactualwidth=ns_marquee.document.width  g- S( [. ^0 L* p- G; \
}5 m% p0 q# i# q
lefttime=setInterval("scrollmarquee()",20): O: {) L! p2 g; J; E7 T6 p1 p
}
, n0 u# N$ g; x0 fwindow.onload=populate
9 h) ~0 [' [  ?1 J+ \; W& p/ V; s: P9 o6 o6 v4 {$ o7 v
function scrollmarquee(){( q2 m' W% F. O
if (iedom){7 O$ d" B9 P0 e4 e: w3 W& H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& \2 d/ V. E7 z; ]$ b$ r9 }! mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 n( M' u8 o! l$ N$ P5 c: V% Selse+ b; C/ Y& i* s  Z
cross_marquee.style.left=marqueewidth+8& Z4 [; C4 b. b* \4 x+ }. X( ]6 H# M

: y% v* y7 i2 K. p4 S+ |}; Y; H* v& o3 P& |1 P0 x
else if (document.layers){
7 L- L/ W  g3 v1 L2 v3 r* T: jif (ns_marquee.left>(actualwidth*(-1)+8)): x1 e# f$ E4 F
ns_marquee.left-=copyspeed$ i9 F" c6 [# K+ N3 }8 }, V& w; S* \
else0 w4 m1 ~; O; B, O2 {7 m, k  w
ns_marquee.left=marqueewidth+8: |( @1 d2 `6 T+ s* z7 w* K
}
) I$ U1 B; V9 J}
% x4 V3 {+ L2 {- ?9 v- f/ M( U" W$ [7 i) l' g% L/ m$ i5 a
if (iedom||document.layers){
9 q+ L  `  ?1 z" L6 x" Y" k4 qwith (document){
' m% }! j2 ?% n: pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" s- s- [, m; s; c0 i9 y( L% Iif (iedom){& |0 }# l7 ?. X6 W# `. v8 Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% ^& z3 |7 T' G/ u) X/ u, Q4 q% A
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 Z- x: r- Z3 o7 E4 ^, zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% e+ q$ e+ Y, l; l  Bwrite('</div>')
5 `" |& A# u+ q, E3 l# D1 A% _}
/ _+ H% s$ k3 g: Z8 y1 P+ Q) yelse if (document.layers){
) A+ ^* V2 n; S2 ?* }) D- W) Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- L: V. f2 g8 {5 ~* l+ P5 l4 O) I2 Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% e4 Y* @3 N8 b9 w- q$ m- fwrite('</ilayer>')
4 D1 ]- ^: i* X# v}; L* _0 w! H. U: ~. N
document.write('</td></table>')  C7 S+ g3 r& r9 u/ G0 n5 w0 T. V
}) o6 |* ]) \. p1 Q4 U- _* X
}
$ x& v9 F% x* o: w+ u</script>

返回列表
【捌玖网络】已经运行: