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

|
网页之跑马灯文字特效
//修改宽度
* }7 B# A' t/ ^! Dvar marqueewidth=300% q# _( A# R, s% P$ r
//高度
4 C" c; D: h6 E7 I8 v6 ?2 Ivar marqueeheight=25
+ I+ H1 k) K$ Z( W. `9 R2 d" N//速度(1-10)
/ B7 i d1 |; O5 j; H8 P, zvar marqueespeed=3
! A% F; d/ i3 u, [' e: ]5 z0 T//背景颜色
$ B7 h9 M2 B. Z6 z3 x8 P. Jvar marqueebgcolor="#FFFFFF"0 m; ~8 p1 K2 J: ^' T0 Q0 h( K
//是否能暂停 (0=no. 1=yes)?
- E5 F2 E( e4 }3 Ovar pauseit=1
6 I: |- H( H; b2 ^7 R& `8 K |* P* k/ y# i4 j- C+ w" x
//修改显示内容3 l/ D7 _" a5 P {! B. z) h+ {) b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) L5 u, V" L' ]2 E; \: A; {
* G! D& _2 U, m
6 S. t7 i9 L ^6 u////下面不需改变////////////
" {' B7 [/ W. N( s `
+ L$ `2 s6 T) evar copyspeed=marqueespeed
5 o# E. ]# {/ C: N" {1 B& Pvar pausespeed=(pauseit==0)? copyspeed: 0; T& B- [- d, p ]
var iedom=document.all||document.getElementById
0 g# H$ D+ b; z) Vif (iedom)
0 v, _* R- @& W" h- \" g; u) I0 gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), G& F4 P: r- S1 J1 t4 `1 t+ C
var actualwidth=''0 M2 ?, n# u2 l1 u# a
var cross_marquee, ns_marquee
8 X% G# d |- R: R, T
1 G$ G9 E- \! B2 pfunction populate(){3 l4 \3 Q% c6 Q: p6 l: e
if (iedom){. u# T' f4 s& g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 g" k; H$ H# r4 _cross_marquee.style.left=marqueewidth+8
+ A, V/ L a7 Xcross_marquee.innerHTML=marqueecontent
+ j! S! Q9 w3 u4 u4 _ tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( Z1 C( O% z% r
}+ w8 x; b9 c. G7 \, S/ i5 f. f' i
else if (document.layers){3 U2 d2 @! @0 l& M% U7 k; N5 @# ]
ns_marquee=document.ns_marquee.document.ns_marquee22 n8 G4 D" X. s. n J1 D
ns_marquee.left=marqueewidth+8
0 x) ]" Z' i; sns_marquee.document.write(marqueecontent)* E* ~6 a2 D/ P! i, O
ns_marquee.document.close()1 O4 X; c! M; l! e0 Q
actualwidth=ns_marquee.document.width: v% I4 F8 E( [% n
}
# W) j3 K, ^, h; d) ~/ V4 c; I6 J1 Klefttime=setInterval("scrollmarquee()",20)
% e# k4 T! A- E8 n5 i( N' i}
! t- S! _3 m/ F9 Z }window.onload=populate
$ I9 L' L, M" H4 j) |! P
+ ~; N3 L9 ] u/ i7 @, u2 pfunction scrollmarquee(){
. S' _' y0 J! z H6 B' L2 {+ Aif (iedom){
0 X: I7 c4 O* _/ m0 @% l; _- P5 tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) m8 e. q4 p" j# ~4 Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ ~, {5 E1 V# Z E) M; Yelse5 }2 v" W) T0 R" C% v: j
cross_marquee.style.left=marqueewidth+88 t' A2 }, h+ R; ^4 }4 i2 ]2 I: W
0 l7 p W) i/ N2 O m}
9 ^$ q. h% O lelse if (document.layers){
9 I1 `" r' H3 s0 n% R" Xif (ns_marquee.left>(actualwidth*(-1)+8)). t. m* r0 K @' @
ns_marquee.left-=copyspeed
& Y( U! j$ C7 B' p selse u0 B8 i. n: Z& Z& o- ]" M
ns_marquee.left=marqueewidth+82 T: R" f1 g$ x% L% I0 @
}
9 X- K& Q1 t! ~' g; _1 R6 s# X}" \. |1 F& X* X! z F. X
% g" @, e U: H) D# J, f
if (iedom||document.layers){- o0 @' D p6 Z& V
with (document){* l3 |8 u4 O" u! S- l3 ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 n% C1 C8 Z2 @6 }( N* j, X, b3 Tif (iedom){
+ e; x* W& X9 _$ B" X$ w" Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 [+ r$ n/ t( f( B$ I, x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 k& n X, q! t* ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% r- s' u8 h: c/ r& S
write('</div>')! _7 m7 o: J; b. D
}
6 x M8 C% v' ^ kelse if (document.layers){
$ k* n6 F+ f+ Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. M, ]6 v& g- J+ N- wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 ?7 m) R+ n0 b9 N- ], p1 t$ @2 \write('</ilayer>')
% R$ A# _+ o- G! J3 g: ]}. G/ b3 e2 P. ?/ l
document.write('</td></table>')
" F) C$ E5 [3 F: L9 ]2 q} Y" z1 H. W1 Z! n& g
}
5 v7 X2 Y8 o) I" [0 e</script> |
|