返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% e' v& h! `  h+ A- Fvar marqueewidth=300+ `/ o7 o% P) O, \# r! t( i( @; S
//高度
5 m+ B/ g' W( t8 n1 V$ Vvar marqueeheight=25
: T7 s: ~6 v. j% w! B//速度(1-10)
: f& F; g( ~/ h4 W5 pvar marqueespeed=3+ R+ c6 i/ Y4 v! A6 L/ ^, L" b
//背景颜色
5 ?0 p8 b6 ]& Z* B- nvar marqueebgcolor="#FFFFFF", D8 u+ R. v' q* S
//是否能暂停 (0=no. 1=yes)?
8 M9 z) @+ X/ @. Q! ?' P( Uvar pauseit=19 X7 q  k! A8 \5 p

. H+ h( p, w; C1 O//修改显示内容
* B4 x& p0 M) U5 k9 Y8 A9 |8 tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. ?6 d6 s+ U% `1 f; ]8 G* ?) _. S0 Z6 k+ @' t" y, i
7 P6 U5 e# y' r
////下面不需改变////////////
, \& N% j7 t7 h. l2 A8 A9 _; ]# t! {% ^
var copyspeed=marqueespeed
! p% J; [+ I3 uvar pausespeed=(pauseit==0)? copyspeed: 0, ^0 _) s9 B8 v6 [, R
var iedom=document.all||document.getElementById
5 Q( z, t9 b( x$ n  p# w7 Pif (iedom)6 i0 }( i: a; R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  x9 M! _, E& A4 m0 f3 E. k# ^var actualwidth=''; l" j- d4 P: {. J
var cross_marquee, ns_marquee6 ~- N) p6 b# z5 z9 V

6 \5 \# Q' W0 }+ \/ @, V8 Gfunction populate(){
* R7 E: z. i6 _0 R0 U, `  ~9 w+ Tif (iedom){% w6 n0 f# K4 x  V+ N  _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 r/ }& u$ Z% y" X6 m7 b. q* jcross_marquee.style.left=marqueewidth+8+ }/ B4 \3 o$ A; z1 Q3 n' n
cross_marquee.innerHTML=marqueecontent* Z; Q6 \& s& v, k5 d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% D# E& y& u7 B% m" b& f0 C}4 t4 x) D0 k( I# ^, D# f
else if (document.layers){- `* J* q0 E! V1 }! W' O, s
ns_marquee=document.ns_marquee.document.ns_marquee2
8 n* i- Q/ p. u) bns_marquee.left=marqueewidth+81 O1 ~/ a1 l/ w
ns_marquee.document.write(marqueecontent). d0 A  K) ?. _* ?
ns_marquee.document.close()' T! G4 Y6 I# i
actualwidth=ns_marquee.document.width/ v4 I4 K0 T; U; R$ g6 v9 W( J
}* d5 J' o( O3 ~
lefttime=setInterval("scrollmarquee()",20)4 [* W. e7 z) x8 I  ?' s$ ]5 ~
}8 D/ Q8 ~8 r) A2 M9 S% @
window.onload=populate
" E: q0 T# t  m8 q: _
. E, `* ^5 g* r7 Xfunction scrollmarquee(){
2 h& b! X9 z) Xif (iedom){
$ C3 z, q# _+ L* L+ Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* `2 L% y0 ~% e4 J# e
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) ?+ i* b# p' Z0 P7 h/ W) Helse
& _8 Q) R, Y! S# {: Vcross_marquee.style.left=marqueewidth+8
& m" U/ C( [; b  H0 ~
: B- s4 d0 }  ~# j. S! N}
  x+ M4 k* P# u4 Y5 k8 J: w6 {2 k& [else if (document.layers){6 N2 Z$ a7 }. Q3 J8 g2 K7 Z
if (ns_marquee.left>(actualwidth*(-1)+8))# ^/ o, N" r1 n; q, ~1 H  W" v/ O/ u
ns_marquee.left-=copyspeed
1 ~1 V" ~4 f: velse
. }6 L- o( O& ]. _; J7 q; U/ _8 Hns_marquee.left=marqueewidth+85 }! i( l5 g8 ^' j
}
% l0 h: B! D/ P7 ]* f# v}
/ ]: ]% L) R% R  e9 ]  B
5 b$ n5 L4 n9 |6 M4 F& F- ~' H) Sif (iedom||document.layers){: ~0 h% `+ N  {1 e4 ?
with (document){+ N4 D. e2 ?  y+ b1 K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 F' f4 d' T# l- cif (iedom){% c8 h2 ]: |% W' y, D3 z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' s: ]# h6 Y* u* z1 `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: z8 X( O. }6 }/ lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# s( B2 y7 n& U" b3 x4 w& [% V' M) qwrite('</div>')( F1 w" E4 @) B  p3 Y3 W* w
}
+ U" V3 g/ o* }- O2 ~else if (document.layers){
8 C6 j1 k" E; }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 X4 J- y& s  ?# N6 H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 g: X8 g( d" C0 y4 O
write('</ilayer>')( u9 m% V  {! _
}" U# w0 b' f. o4 l2 \1 @* q  G1 ~  n7 f. T
document.write('</td></table>')1 W3 E& m9 _  Q. X# _& v
}  D9 X% }; ^: ~: ~% X( W
}/ Y& C( L$ u- o( c! E7 H
</script>

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