返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 F& _+ x* p+ C( d8 y% \! x0 Ovar marqueewidth=3006 U" M4 c, m7 L+ j2 \! F$ B
//高度
) f( N* c# T+ _; i  n# p) X0 p" W7 fvar marqueeheight=25
5 J- E* J  C$ s. k7 H: E* u//速度(1-10)
9 s" ?5 n* n2 D9 gvar marqueespeed=3& h% X& d- _% z  Z0 G7 ]. @
//背景颜色
- E8 l, @( N3 tvar marqueebgcolor="#FFFFFF"! O, K0 g' h% Q# u; r, c
//是否能暂停 (0=no. 1=yes)?
: _: K0 |" g" N2 {; Gvar pauseit=1& X; g( {/ t: j% z4 `. G% i6 v  f' B
( M8 ?8 q9 r9 \  W% J( t* v+ w
//修改显示内容! R$ A2 U* u3 N: C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 R, P  J' A$ u* I( T! p9 d
% a# w; H$ q: R$ g: `* w8 k- b7 j9 g$ N1 f$ `2 ~
////下面不需改变////////////0 J  z8 h, o1 A2 Z3 ]
6 \& z5 v  t9 E% Y
var copyspeed=marqueespeed# z0 y; N. `7 w4 `# k4 Y; ?
var pausespeed=(pauseit==0)? copyspeed: 0- e' h" _0 d/ l: M$ ^( b5 f) c
var iedom=document.all||document.getElementById. O1 E" N6 O8 D9 x% L
if (iedom)
- q& T3 O0 Y* E; l. Jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& q; O6 {8 O1 R* V- [3 tvar actualwidth=''
% q8 B5 T' b4 Z5 D/ Y, z9 Qvar cross_marquee, ns_marquee
0 E/ |* R- o4 ~9 o. t2 ~5 j, _) k# D  c% X, Y4 g* U9 @
function populate(){: Z3 c, O( t1 L# e; D& ~4 y
if (iedom){% z9 |4 [; E, x, _! |. I2 c
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* l/ U0 u. W4 V( f4 p  {cross_marquee.style.left=marqueewidth+8. z+ [8 p* s% `0 p- K, w
cross_marquee.innerHTML=marqueecontent
  I& x3 y/ q# a! nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: H$ F% w4 r) q- J/ o: j}
5 |: X  K- ]2 Y. e$ i: [+ M% Qelse if (document.layers){
% I! l! Z$ E% u6 Y$ Ans_marquee=document.ns_marquee.document.ns_marquee2
9 W# t* g' t5 c" I7 u0 a! ans_marquee.left=marqueewidth+8
) T5 Z- R4 N+ ins_marquee.document.write(marqueecontent)
* Q' @' n( R+ p% r0 l; wns_marquee.document.close(): H& Q7 T9 a2 i8 d  H! q9 t) V- Y
actualwidth=ns_marquee.document.width
8 Z* m2 J! e* R; i0 [: ?# o. G}
4 Y" ~! H* D3 a6 Mlefttime=setInterval("scrollmarquee()",20)4 x# p8 f6 `7 q" _* a) G8 \8 R
}  l( D, p# m- ?! ]
window.onload=populate. K9 s/ T7 [+ g* i+ i
9 w* Q! p0 r$ m  h# r, D0 O4 m. Q
function scrollmarquee(){( H5 j! o) Q& Z) N1 r8 k& x8 @
if (iedom){
) @; f5 |5 _' i  y1 U# M1 Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 O/ z) Z* z4 _4 [& {4 Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 j' k& a3 y2 V2 |else
- b  |; y9 p7 o, K5 s/ }+ jcross_marquee.style.left=marqueewidth+8# n4 Y+ y3 ?6 s/ x0 _

! I6 ?% A1 p4 {8 [3 B}: w. {9 f9 T# D- K
else if (document.layers){
( g, Z' A# \5 k  H4 [if (ns_marquee.left>(actualwidth*(-1)+8))0 p4 C8 `5 b2 j4 x% ?1 G; p
ns_marquee.left-=copyspeed+ k; A0 f: c  D3 M8 V+ f
else
( s" N: l' ~3 S3 J, Bns_marquee.left=marqueewidth+8
- y3 N2 k% F' O3 R) F" x/ w) X}: B0 V2 T- b) x5 H6 c" O+ S  |
}" i" S4 z. \. t/ l( U, Q4 O9 n

  n) D: p* X( y3 Uif (iedom||document.layers){
4 f9 ^' `; h, q6 ?with (document){2 P) X) a& t- B/ C" F3 w0 A( ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ A* X! b- A6 bif (iedom){- {0 R1 A8 g3 J1 O+ r( }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; |9 M0 T! o8 P1 c5 Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 _4 A. }) t' c* Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# \4 \+ y0 J1 m# k
write('</div>'), \  f3 d% h+ t  |
}/ U# C4 V. _& M0 c% U2 x
else if (document.layers){
, E' p7 l7 c4 n' D) Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 e' x( f- o0 i  Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& ]- R2 L% y4 X/ j  Dwrite('</ilayer>')
* u4 \5 O1 o0 O) {* W}/ L+ Y+ ?- U4 D: M  R
document.write('</td></table>')5 b- x( d& S, t
}
) N+ {4 I2 h+ }# V8 V}
# O6 v" X; m$ b/ p; u</script>

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