返回列表 发帖

网页之跑马灯文字特效

//修改宽度; G2 l8 N8 c0 }2 z2 b
var marqueewidth=300
# }2 O% i! J7 N! N0 ~//高度& m9 f) N9 z' m1 i; [" Y& M7 @
var marqueeheight=257 t4 R* S4 X1 O6 x+ r6 |% Z! ?
//速度(1-10)
" z0 r! |: r; S5 _" ?var marqueespeed=3+ G& ^# P( T  I2 z1 Z
//背景颜色: N9 k7 d# l( Y1 R. ^
var marqueebgcolor="#FFFFFF"
. f3 M0 M4 T, J4 [" _//是否能暂停 (0=no. 1=yes)?
4 `" H2 H4 J9 Q& {var pauseit=1+ E$ k& ?1 T  {. L% U
- u! ]  S2 @6 y0 u5 X
//修改显示内容
$ G0 }) m& I- r* w2 w1 Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 X1 k( L' C2 P% T
- {* j% `+ \+ P) i3 z9 M# u9 R

( }+ c3 b+ B3 \3 V7 z) N////下面不需改变////////////" l( u$ A" k' w2 u! |& V6 k4 J

. x2 J8 n; c: C" A$ ~2 d2 A: i4 Bvar copyspeed=marqueespeed+ f: C! G0 V3 |2 L  ]
var pausespeed=(pauseit==0)? copyspeed: 0
3 |' ^5 T/ [" ^. xvar iedom=document.all||document.getElementById
3 q* w: Y2 q9 s( Vif (iedom)9 ]3 t  I7 T, J: C$ D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% k' I& b1 e$ R3 Dvar actualwidth=''
/ A4 K1 d# k2 k" T' Wvar cross_marquee, ns_marquee
# C& V. I( O. a' A5 H' X' w
  u3 j! z5 F( j7 B' @' R6 l; u* kfunction populate(){" \6 k1 G3 Y5 k0 N! m: y
if (iedom){
. k  K' |3 d7 M3 Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 o# o/ B- K! w, B. _cross_marquee.style.left=marqueewidth+8
* ~6 A7 t8 S8 _. tcross_marquee.innerHTML=marqueecontent
( E+ Y# ~( l# m+ }) A1 W3 }, l6 eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. q# r1 u3 I: r  U& _0 z
}0 P8 e/ P9 P8 d* _1 K
else if (document.layers){
6 q9 w8 V1 Y  p- y! E8 q% V5 mns_marquee=document.ns_marquee.document.ns_marquee20 q; T4 U; [; _% y4 K' t
ns_marquee.left=marqueewidth+8
$ k# v" N. Q; tns_marquee.document.write(marqueecontent)/ ^1 U% n) r4 t2 C
ns_marquee.document.close()
' F4 E) ?0 }. C5 F- f, N9 `; tactualwidth=ns_marquee.document.width$ O! y1 ?1 r5 \6 B* s" Z
}2 m& c+ z, L- D, |( M- W7 y* V$ Y
lefttime=setInterval("scrollmarquee()",20)* y& ]" p1 t) b3 |
}; H$ C$ A2 d: E
window.onload=populate
$ T, V& O: ?# \# j& o  h* E6 ~: m1 @( O2 g" s& B! K: H
function scrollmarquee(){' D. R" E$ W* B% z- L
if (iedom){! R% p/ v5 q+ L6 b' E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# j1 {; X; Q3 ?; X4 q1 tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ R; ]9 p- R  s9 Xelse: b  g4 Z3 G  T4 q- x
cross_marquee.style.left=marqueewidth+8
8 a3 S- T1 L$ C( r
% B: r8 O9 w- V% r5 m: k}
3 e, A  Z% e/ _) R* a; D# xelse if (document.layers){
5 B' o1 z+ S! q6 p  Cif (ns_marquee.left>(actualwidth*(-1)+8))' [% G( j0 Q# z  j# ^
ns_marquee.left-=copyspeed8 q' j  l5 r1 O. }8 b0 Y
else
8 I: o3 U" C+ n9 _) fns_marquee.left=marqueewidth+80 Y5 [4 U- Y. C5 a; R
}8 t: r/ |; f! A: q  R" i
}
; n+ x& V0 g  Y4 t0 ]5 u3 ?7 O: q9 R3 g
if (iedom||document.layers){
$ z  C4 P) g; D9 ^- a6 Lwith (document){- J8 ~; M: p# O3 ?. Y# x9 Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) i0 \- n- N  p& E# m7 D
if (iedom){/ _& j' W, |. s' F+ E& n9 t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). P; o+ p  b% v3 i6 l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): `7 i6 I; |  c) R
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; |1 a: \* t2 r% y6 M& V1 iwrite('</div>')4 O0 j, G' W( [& ], l
}
7 v& U# @, N% U' Z" Qelse if (document.layers){* _/ t; k) K0 q$ f& E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 |6 O% Y- p  e, ?3 Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' V% r3 |) N6 q! Z
write('</ilayer>')# X1 O0 D3 s6 n7 Y
}
/ F0 C( b, q6 m1 }document.write('</td></table>')
- \' Z: G. D7 t) J5 ]}' p! }0 d; ~2 w& G
}
* y! b+ L4 m: M6 j! `0 q</script>

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