|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度' a" k+ u. z, t7 Q6 L2 l; m0 {
var marqueewidth=300
: s; Q8 t, [0 k0 d" o) m7 V//高度2 O/ G1 i( ~$ i# x
var marqueeheight=25% z& A+ g2 b/ R$ F H" k
//速度(1-10): \& }/ r# w4 Q/ Y j" b
var marqueespeed=3
, W4 s/ e, }+ I: `' W//背景颜色9 g% [1 h- V2 }6 F! s
var marqueebgcolor="#FFFFFF"% }0 V/ F8 K: x3 \$ R: `
//是否能暂停 (0=no. 1=yes)?' M6 e+ @3 p! H |- C. E
var pauseit=1* O4 W0 U, c5 ]1 _! _* X8 b- O
% N1 k' R/ k0 |* |//修改显示内容" g$ W: A1 H; m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ v# T- [$ F5 E0 O; u5 a4 g1 _
$ S- c' n1 f/ Y- F
9 n! i% ?- ~" T
////下面不需改变////////////
, q4 m6 g1 U3 k9 Z% g, z) j3 l- L# p$ C% t' V
var copyspeed=marqueespeed1 |, T' U6 Z7 R" H: C/ F2 x; l
var pausespeed=(pauseit==0)? copyspeed: 0
! j; t' L3 O4 I6 {% ?( \9 avar iedom=document.all||document.getElementById
# t. O, _! H! T+ p c/ Cif (iedom)7 B# G4 j9 | C+ Q8 H4 L2 b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 q+ R' r; Q* P2 O T' t5 x& A) L1 u8 f
var actualwidth=''
! ~4 ~3 ~, x) P0 Xvar cross_marquee, ns_marquee
7 X: v9 v2 W7 i2 m- W( L) D( Z8 K4 n9 H( `( R
function populate(){$ @/ u( _2 v5 X4 P2 w
if (iedom){; g# j1 G) C* f$ m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* G$ D% [" ^0 l0 Zcross_marquee.style.left=marqueewidth+8% e, e& n# Q, v5 d
cross_marquee.innerHTML=marqueecontent
) f1 M1 k; j# @ S) `. J0 \: _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* A2 j0 i( C* f0 }) e
}& k6 }8 |* X, w) D& Y! m
else if (document.layers){0 i6 |; C9 b- S. @ Y# Q
ns_marquee=document.ns_marquee.document.ns_marquee2. w: D0 B+ o( g+ T; y
ns_marquee.left=marqueewidth+8
$ ?7 ]7 h5 x) V) Pns_marquee.document.write(marqueecontent)
|: k# \: W+ m) p6 Nns_marquee.document.close()
3 ]8 O4 w$ D4 }% O6 w& \/ Vactualwidth=ns_marquee.document.width
3 V* T6 T8 a* F1 q}
% S/ V/ U: f U9 f+ z6 k3 O- Rlefttime=setInterval("scrollmarquee()",20)
" L* t6 |; S5 {7 k}
) w# z) }1 G8 v0 u( nwindow.onload=populate
& K4 m! E! z6 E6 q K X* _$ W
( b4 R' A3 S5 l4 `1 I3 @9 xfunction scrollmarquee(){
, T* q$ u9 H8 c: ]9 Bif (iedom){. t4 D; e2 D- C# x2 S0 u) d0 e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- r- h9 f& N. s4 i8 W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ f4 P1 [ x k+ B: J4 N2 celse" S+ F F% x8 R' N3 D' t
cross_marquee.style.left=marqueewidth+89 g$ h8 R0 x- w" n+ L
+ @: t0 x+ f- n1 S0 v! V
}
. Y0 H! n4 {8 \% \( Melse if (document.layers){1 a3 }+ d2 ]2 S% t
if (ns_marquee.left>(actualwidth*(-1)+8))
/ D/ [/ Z I- hns_marquee.left-=copyspeed8 O" {% @4 ^" S v
else
1 v1 H' `2 J4 u' Sns_marquee.left=marqueewidth+82 a1 D7 h4 i" W: p" H" H8 l4 N- p
}
. ^6 Q' Z0 }( F# K) E}# t1 @/ x. Z6 h$ Z
: P+ [$ M; b F) E+ a0 q) f' S
if (iedom||document.layers){
/ _. N3 s2 \, M4 Nwith (document){% c. F) o( B. P; M' }: X" W% L9 K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% b7 J+ p4 q1 d% S# `9 X$ u
if (iedom){* f) @, b$ n: X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: q" y- s) ?. Z" X n/ Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') S' I0 b) W$ j) U! [+ b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ l) w7 x7 z! @7 V! E
write('</div>')
# L2 T3 ^% e2 a7 S! z, J" u( |2 P# d}
& A. b0 l" @, M! N: w1 lelse if (document.layers){
+ {2 X2 J2 U1 bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): H+ ]0 C2 O4 X t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 [) i5 V$ h: d# b
write('</ilayer>')
4 u' p" F, ?" h5 u}
5 L4 y9 \2 ~/ {' m& \* _' Mdocument.write('</td></table>')
3 M) f7 V; a3 x& G/ V( ~}( ]3 _+ u' [7 o6 |
}
! j0 w' L/ X8 I) {' D/ T6 p7 ?' W</script> |
|