返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! L0 G/ r& H& ~* w# Jvar marqueewidth=300
8 G& a, K( a+ {' t) K& N! x//高度" {' {& n! a6 b5 k/ ?
var marqueeheight=25
$ m/ V- F4 e& X5 T3 C//速度(1-10)
3 H5 ?" C1 O0 ~- ~var marqueespeed=3; d2 L9 ~( h9 h, x
//背景颜色
1 i+ Q2 V5 u) P3 avar marqueebgcolor="#FFFFFF"
) E4 A* ^$ F% `- y* S; @' v//是否能暂停 (0=no. 1=yes)?3 G; \- W2 e( V( I: Q, h
var pauseit=1
+ k! M0 j  i: R/ \- H4 }9 F( ~: R
) O( m0 v" x0 Y2 ]+ C3 f/ R//修改显示内容
+ ~0 p& q0 Y1 |5 U+ K) Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, V( |; `+ Y" H  r4 q4 }4 }- I5 S& a) g8 _4 p, b- i
* E( }3 K1 T5 a4 c! E
////下面不需改变////////////
; M6 d, l6 T. S
* ~% F$ Z4 i' _6 ~- v% E& `var copyspeed=marqueespeed
9 u5 Z+ a- F; ^5 x: }6 _var pausespeed=(pauseit==0)? copyspeed: 0% ?  u, |& [: w
var iedom=document.all||document.getElementById9 B% [: r& }& d
if (iedom)# Q7 m, M' e0 ], w' }+ ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" _% l# k: N8 W9 n5 e  K" f$ c- v) R
var actualwidth=''
7 ~% a( W. Z3 @3 T- L" I% k8 J) cvar cross_marquee, ns_marquee# o  T' I* ~; ?$ S+ e0 `7 X- s; ~1 ]
" W# b' t$ v3 h* j
function populate(){
6 J/ ?' j' N& T: f9 t. R* Kif (iedom){
& |$ j  z+ i3 Q5 w! [, across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; {* R" [9 P) U# o' O- Jcross_marquee.style.left=marqueewidth+8: t7 y# e) [' V% U: I* Q
cross_marquee.innerHTML=marqueecontent
- [# z+ [$ Z0 r; O% vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# {( S3 Z. O* u' Y$ p  }% B$ D# ^}6 k% x/ ~  X2 ?# t6 L( v! G$ |: r9 Q
else if (document.layers){
5 c+ g& Z& V' {0 v$ pns_marquee=document.ns_marquee.document.ns_marquee29 J/ `0 `) E1 @0 s# l
ns_marquee.left=marqueewidth+8
3 o2 v/ E! ~6 n( Y8 ~: V5 Ins_marquee.document.write(marqueecontent)' S8 ^/ O7 q2 @
ns_marquee.document.close()3 @+ f8 \# j! A; d
actualwidth=ns_marquee.document.width
& c# P& l" h+ p4 a; W* ]}
+ [: M  s. F5 R0 e- olefttime=setInterval("scrollmarquee()",20)2 j% F8 [( C2 o. \
}
) `7 B' W- [$ s- w) Ywindow.onload=populate
& `. Y: h2 b; V! O4 G: z! {
2 B1 m2 D7 M3 @1 y8 Z6 O& J4 Nfunction scrollmarquee(){$ `6 W# A; k; n" r5 S
if (iedom){2 q6 }9 S% L5 ~0 F' q- _8 j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 \$ H  S, H) j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ j) L& H9 v8 R
else8 x- j* Z6 Y5 T3 N! A3 p9 `
cross_marquee.style.left=marqueewidth+88 ]' |: X+ U- v  g' @3 @
, C9 h6 D  _+ S. t* r, w
}% q9 b" E- @9 s( c
else if (document.layers){
) L7 _0 r( W) G6 _* H/ X) e8 mif (ns_marquee.left>(actualwidth*(-1)+8))
5 L# Q) P1 N9 k$ f6 z4 R6 l. lns_marquee.left-=copyspeed: u, U/ n2 V5 f& ]
else
- x5 M$ D8 R% M- t5 w2 L, Lns_marquee.left=marqueewidth+85 t6 V3 _2 `! h+ A9 I9 _7 v
}1 z- f- N" l0 o( f) ?
}
9 k# c2 f* b, W" i% i& z6 v; C' q! e# ^. ?" L) a
if (iedom||document.layers){# O, D! h" c, R) T
with (document){/ n, j, T9 r% ]8 @" m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 Q; G& ~- f! {9 _0 ?
if (iedom){% e9 a! h# }, x; f+ T. _4 \- J1 E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), Z- U9 y7 t+ ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): [1 C+ o" F/ [: B0 t( \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 Y; o5 |: @  t/ _  ]8 Fwrite('</div>')
, r/ R; U6 w5 U$ {}
4 N3 f' t# ~! Y/ b5 ~else if (document.layers){- m& _) F! S8 V4 m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ E8 g1 h1 O  ^) d- N) ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* k0 u! d0 i9 Mwrite('</ilayer>')1 q) ]2 f) N5 l- O
}
7 ]( T" f8 S0 G2 kdocument.write('</td></table>')- `$ n/ C8 f+ S! e
}
* \5 v% }9 K! r& R0 Y! K}
, f  Y1 e; k7 x: }' U</script>

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