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

|
网页之跑马灯文字特效
//修改宽度
8 K, z2 u+ V9 Y! J f" ]" W) `var marqueewidth=300! G; @5 l; w" I* K9 z$ @/ |
//高度. ?5 Z; W, n9 ^5 R/ X
var marqueeheight=25
0 ?8 E. x5 ^- }+ o6 I3 S//速度(1-10)# W+ W0 z% m& K8 }. U
var marqueespeed=3! ]3 } Z, Z5 K: s
//背景颜色
0 K. t5 J1 T$ s, x. I; Avar marqueebgcolor="#FFFFFF"
* s5 q5 y7 M, u* z) G4 ]//是否能暂停 (0=no. 1=yes)?
2 K* ]6 D9 \/ ?2 u4 O* i avar pauseit=1
( O, P5 B" |0 A( l1 V9 T
6 _9 D& c8 ~: Z0 S8 o//修改显示内容 u% D% ^! \) ~0 U! a7 t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 k& k5 l7 o$ g0 y
`, E, g. {* l9 O) Q
7 { y% G/ G3 D/ b: q: `3 G0 W////下面不需改变////////////9 u" s# x" v( v' w( G! M- p
& ~8 I. H4 Z* fvar copyspeed=marqueespeed
7 A- _& t4 ~7 o6 X9 Ivar pausespeed=(pauseit==0)? copyspeed: 0
7 Y4 l3 |! Q, I" Qvar iedom=document.all||document.getElementById
' o" ?- J( j; W% X( fif (iedom)
% X; ~2 u( t" F8 t+ t8 }4 {8 vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. g& A* h6 x$ c( b0 p0 uvar actualwidth=''
: J# C9 c1 T5 evar cross_marquee, ns_marquee, b3 G$ f6 Q1 z( N% R( j. i
: D+ ~( h0 _4 A4 p; ifunction populate(){8 F6 _! ]3 }6 }. v
if (iedom){
( P5 X% e/ h/ Y# F3 t. {" zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. r- k, @/ a" k0 d. a/ Dcross_marquee.style.left=marqueewidth+8$ c* z) y* v0 y0 R
cross_marquee.innerHTML=marqueecontent* |1 \0 L, l; f7 k$ J) y( @( W3 T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 x1 y) k `$ T+ E5 e5 b/ Q}
0 M/ L/ r; ^: f' Eelse if (document.layers){
, t- ~* z, W1 D- Ans_marquee=document.ns_marquee.document.ns_marquee20 {$ x1 \" b0 y5 ^0 w
ns_marquee.left=marqueewidth+8
# B Q5 p5 h* i8 ] T& a7 ]9 ?ns_marquee.document.write(marqueecontent)
& D$ K0 _5 b8 G, t- P7 }" h0 o. lns_marquee.document.close()( }. u7 m3 o# s+ f# i$ F
actualwidth=ns_marquee.document.width
1 B3 G* q5 U3 \2 _# |# h}
) I6 T4 G9 J, r. L4 ?; X( O# r, R5 Jlefttime=setInterval("scrollmarquee()",20)% N5 }+ Y0 U9 G
}* s+ h7 j) d6 ?' v- [! O
window.onload=populate0 M! I7 V& D8 x& `; M/ w
* x% q% f2 y0 y# C# q' Qfunction scrollmarquee(){: e% Y$ @1 t1 E- G
if (iedom){
5 k# p0 U0 y# Y5 Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, K- J8 f0 O- R3 I3 Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 G6 v- ~5 M- Z% Telse
9 I; L/ P% O) q2 L& ccross_marquee.style.left=marqueewidth+84 `" P/ \4 j* x2 w2 M. G3 I8 S! t
4 J' q: f, }( M& l
}$ m. P$ p7 D$ }' M5 E: e+ ^$ W0 l
else if (document.layers){
1 ?: b0 K l6 ]/ H( p kif (ns_marquee.left>(actualwidth*(-1)+8))
4 w* j# n4 z6 H, ~8 Y/ X1 [ns_marquee.left-=copyspeed" L4 b$ W5 R: X3 `, h7 K
else+ R1 W' z3 {3 l3 V% @# [ E
ns_marquee.left=marqueewidth+8
6 k4 v2 N9 d) r}5 b' R) b7 p% H6 U ?
}
( L8 N+ }$ F' u
6 j g4 l& P% B& eif (iedom||document.layers){
+ h4 H- n& D7 I& o: D+ Q( Nwith (document){4 Q( L0 Y7 G2 W8 q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- f( [% G7 g* \' J# H3 K# B2 [if (iedom){
) c& `: [" A! X6 ? m8 {9 }, ^write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, p1 ?/ O* K& h0 }! awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 @2 _0 T# C# v' L1 W2 X" \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 r& `; _; p3 k
write('</div>')
) T+ o8 M" d E" E2 `+ I$ l}* O$ z' B7 E# B8 e
else if (document.layers){
" L% S5 x+ c/ k' e4 P7 y9 Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), r9 B4 _2 l6 c. O& T! U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ F* n+ a* l# K1 d, q$ ]0 Pwrite('</ilayer>')
8 {4 ^) b5 m- C: F}( @6 N7 |2 P5 K8 E8 A5 `, A
document.write('</td></table>')
) h2 P. c4 ]" u. n! r* T! H" K}3 v0 t* l! t& g% c
}
. F: K, F, O |</script> |
|