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

|
网页之跑马灯文字特效
//修改宽度8 _- m, |) V4 x" @; \) L9 d
var marqueewidth=300
0 ~( m. I6 ]8 }& W//高度
8 O) W5 a/ m9 p% Q$ @( Dvar marqueeheight=25
. |1 D( g# E( I( R$ a0 s- g; }/ j//速度(1-10)2 G, F P) i1 @2 s' D& E
var marqueespeed=3' \3 u7 Y- M8 {& a b
//背景颜色 O3 B) K% e, [# r* @" a# U
var marqueebgcolor="#FFFFFF"5 q# y8 O1 O, k1 c$ ]
//是否能暂停 (0=no. 1=yes)?
/ _' n$ ~ E$ X- ivar pauseit=1) V3 R3 Z$ _+ n
1 M0 `1 @& H: I' x) L0 r- [//修改显示内容
0 b% i" z; C+ g( |4 J. W; Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ p! E* O: ]6 x. @2 p" D5 v& I8 M0 p, ]) i$ o) U
( Z. M8 s2 ` a `& ?////下面不需改变////////////
# Z0 m, M; W+ o2 W8 N
3 w: N m3 O2 F& s$ Dvar copyspeed=marqueespeed1 Y8 l# W, Z. V& _
var pausespeed=(pauseit==0)? copyspeed: 0# K$ r5 t* B$ k) l7 u
var iedom=document.all||document.getElementById" d3 I2 @4 y' V" M1 u& B
if (iedom)
" c( e: n U* J/ l9 [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# F$ @% v" u0 N4 D' R, tvar actualwidth=''
+ F* V" `$ b. y; {& l2 D) zvar cross_marquee, ns_marquee: I+ M4 s# W, r( v4 E- u
/ G3 q. {( G$ Yfunction populate(){
1 h. a4 D% a/ qif (iedom){; O L) E- d( P1 m# N
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 P: S2 }" j7 T8 W0 k9 _" xcross_marquee.style.left=marqueewidth+8& p8 M; u4 @: Z8 @+ T
cross_marquee.innerHTML=marqueecontent
, {3 c( o0 W+ O% y1 Q3 A( ?: L5 Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# j+ W. N% y0 p& c8 x, h
}
5 U6 I& ?1 y* q% F7 Oelse if (document.layers){" u W6 D" ~2 H ]2 y. `3 W
ns_marquee=document.ns_marquee.document.ns_marquee28 r6 m! k5 Z7 Z# g8 b7 W
ns_marquee.left=marqueewidth+8& L! Z# g- f- G$ q3 P6 J
ns_marquee.document.write(marqueecontent)- I+ \# y5 Q* x+ Y
ns_marquee.document.close()
' E6 u/ B) `, F( K( K8 Kactualwidth=ns_marquee.document.width
u. k2 c2 a0 P3 `! X( ^2 G}
3 |. A5 D m% U. j, Qlefttime=setInterval("scrollmarquee()",20)5 c, K- q0 H C) Q
}
$ W$ q: |" G. Ewindow.onload=populate1 v. J G! W5 N7 G; z" D: l" k
3 @9 ~' h& W3 E Tfunction scrollmarquee(){
# O6 X1 T8 u" e! cif (iedom){& Q( f: Q2 u! @; j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); E5 W5 ?' @6 V Z; O1 v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 B+ M3 Y% Y0 t: oelse' c! S$ f3 R) ~+ f; g
cross_marquee.style.left=marqueewidth+89 H# } E% u1 h. O( l
7 j P2 U; U, t0 t" E" L' a i& b
}# {$ @& `) w* Q: b6 ]2 C
else if (document.layers){
/ T6 p! `, K8 Z1 p0 mif (ns_marquee.left>(actualwidth*(-1)+8))) a6 _$ |+ M. k( d5 r
ns_marquee.left-=copyspeed
, F/ n6 J! |; A: R# }+ g9 O2 _else
7 Z1 L7 r- W0 v0 H( V9 K3 Pns_marquee.left=marqueewidth+89 U5 l, Q' h; {) ^
}
$ _% J; p$ M) W0 t}
8 i& E4 Q% P4 z- a5 ]: Z* q
4 U- r- Q7 B [* Cif (iedom||document.layers){
5 u8 n5 d' P/ g1 b" z5 V) V( bwith (document){
1 n% o/ A. c* m( [& q# }document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) H8 r/ O* U1 m4 a" h
if (iedom){
: G6 D/ u& F1 f) j" O# P1 t% e( I1 [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* f% x. S/ d' W: o6 X2 H' N, O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') L* A9 S2 m/ G9 _0 a% w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( Q- p* o% B8 J' F" u3 [7 ^1 Gwrite('</div>')6 J' p( }8 c( z7 k4 g+ q; E
}
2 d4 |8 U o$ E' _5 velse if (document.layers){
+ \8 y0 \# K( y+ Y8 Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: W4 [+ j7 Q* P$ i {& r: s$ Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" \' {1 d$ o$ E' G
write('</ilayer>')/ b$ Y/ B% B1 z& I. k" c b
}
8 K' p7 @3 M+ e! B i* o& b7 Idocument.write('</td></table>')
+ j. _5 @, ?# y7 J8 }7 @}2 q' R0 t* Q! ?' ?
}# V% y, g+ I q* G3 b; |
</script> |
|