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

|
网页之跑马灯文字特效
//修改宽度
: g7 W" B) @- W& dvar marqueewidth=300
9 y/ d0 B3 \9 c! A3 A# t//高度
9 q' H4 K5 P8 H5 _$ v0 Y$ [- Jvar marqueeheight=25- q4 Q+ A( ~2 H: @8 g
//速度(1-10)
3 C: O/ l) |$ p! Xvar marqueespeed=3- h0 X3 a+ _# [; D/ Z0 c
//背景颜色
! R. d; P9 E7 k4 d( F! a4 E4 hvar marqueebgcolor="#FFFFFF"5 p& M6 G) Q) _: `# K
//是否能暂停 (0=no. 1=yes)?
" u- F k! {8 Z$ `" yvar pauseit=19 ^7 ?; [( o; @
- F$ G- Z0 B" b% |0 k6 u b8 p
//修改显示内容
' |0 U. o5 A: R# Q. Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. v6 Q" M8 B. z& d0 }7 a5 I
* q; T2 J' G( a' P/ @5 ^
# [4 w( w6 U8 c) v) ^////下面不需改变////////////
0 @/ ^2 t& L/ @5 u7 Y6 h. x6 J' z' W4 N+ f/ Z$ R. j2 p
var copyspeed=marqueespeed
( U* z( c: `+ {var pausespeed=(pauseit==0)? copyspeed: 0
* t) W7 s q3 m6 d/ Vvar iedom=document.all||document.getElementById& f! _& z2 W w+ @/ k
if (iedom). U+ S+ {/ Z9 _4 _5 h2 ]! t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ |; V4 r# X. i( s+ r. \
var actualwidth=''* B: j& Z9 b$ K+ e3 h1 }2 ]
var cross_marquee, ns_marquee: B# f; s& F5 ^
1 _/ W% t1 E- s( B1 |
function populate(){
: s) u& E. {7 N: Q& I# b& \if (iedom){
7 J0 Q+ s* m8 ~0 x) {4 j& Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; }- ^$ T- [# z" N8 U) r
cross_marquee.style.left=marqueewidth+8/ Z, R7 k8 k# ^! a* | l/ K% n, q
cross_marquee.innerHTML=marqueecontent
& W; a( m4 E: X4 `; R& ^% @actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth E8 g. ?. i2 v2 V: w2 F
}- s5 M s) K. m* i
else if (document.layers){7 y9 H2 |. ^; C
ns_marquee=document.ns_marquee.document.ns_marquee2
9 R: z# v3 o) z7 _ns_marquee.left=marqueewidth+85 s1 r" N) H& o7 c0 L6 P5 R
ns_marquee.document.write(marqueecontent)
/ g0 @0 H+ l- f, tns_marquee.document.close()
+ L! u, J# r- V3 vactualwidth=ns_marquee.document.width
5 C F* M3 K& E, D7 g}' Z1 b+ V$ r0 A4 W$ ?
lefttime=setInterval("scrollmarquee()",20)
2 }! {5 y, r: p; k}
; ]+ y5 D* Z: R* a8 `window.onload=populate
" c4 x' O+ |" a4 z; G4 u9 S
8 g, j' x5 R# i3 D5 v; f5 Nfunction scrollmarquee(){" A! b! {! U- q0 Z1 N% s
if (iedom){/ V9 {% Y8 H( I6 E1 X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( }- c9 |8 Z8 z/ d; p; l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 f+ b) ?* H# x6 U0 ~% Nelse
6 k7 v" L \/ T+ Y& M6 |# gcross_marquee.style.left=marqueewidth+8
$ N5 x% i7 k% d4 O% Z: h/ L8 Q. H- d2 O) M; R1 N
}" \: m L2 u5 z2 }" W
else if (document.layers){& H& _. m7 ]8 I. f- k F8 `$ k
if (ns_marquee.left>(actualwidth*(-1)+8))9 D+ X) Q1 @1 t9 r9 w
ns_marquee.left-=copyspeed
# x+ O# k* ^7 Qelse
% v/ X3 m) l, }' ^5 l$ p1 f/ s: Fns_marquee.left=marqueewidth+8
; g6 s1 \6 I2 u: ^- _}( M. A3 P7 n" h
}5 ~6 a# Z; g$ p# ~
- K, t) h( q4 t
if (iedom||document.layers){3 X* ]" x9 ]; ^
with (document){7 d/ ^# j* {# V# T2 I7 @8 K) _- b, F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 I7 y: U0 m- h6 \7 n6 H- {
if (iedom){* V0 G' A4 u# i, O7 A& }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 ?1 y# m/ d) ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 m0 Y1 G, P, }+ D, R ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 J5 ?! g6 J/ w# {. u6 x: \1 x
write('</div>')
8 `# [4 \( u j) G3 N3 O. C2 @}" |1 b3 X7 B* o! G* S
else if (document.layers){
" Z6 A# l/ `1 ^& s& d& swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: D& Q4 i: e; m, J6 |& Y1 }write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 A+ U8 J) E& Q6 \# q; y/ G1 m! o
write('</ilayer>')
d0 D9 g+ ~& J) I3 P}
+ Z8 _( o5 k" y/ b/ p' F; edocument.write('</td></table>'). ^$ T! O8 D `0 b, O
}, U# B# L5 }8 j1 e! f, b& V
}
! |6 n' l/ v5 I$ i9 q5 v3 C</script> |
|