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

|
网页之跑马灯文字特效
//修改宽度
' A% \" ], T/ y2 Q' yvar marqueewidth=300( v/ }! |: N% `
//高度
/ j1 w6 r {3 Xvar marqueeheight=25
+ ^/ m2 i7 E2 G9 p//速度(1-10)5 w, `' _+ D& Y+ n3 D: i( t
var marqueespeed=3
1 n% w8 `: w9 e/ h; M% R//背景颜色
) I: O/ R- t p2 r# {var marqueebgcolor="#FFFFFF": X2 Q6 I2 N3 Z! b! R7 X
//是否能暂停 (0=no. 1=yes)?
# x4 X* `. I* i; Mvar pauseit=1
9 U" V: z, }4 f6 _% V1 n7 ~% G$ E }7 K9 [8 o" T- K& O2 p$ W% D6 ?" C, S
//修改显示内容+ u9 K9 }* @: n* `/ T3 g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ y5 G/ B. ]$ U- N2 S' F2 Q3 \1 `( z; I
" z! K: V4 Z/ Q' {9 [; i
////下面不需改变////////////, _6 M# F* O% O" R& W! m# w
/ E3 G Z" S( f! p" _$ [9 _: B
var copyspeed=marqueespeed+ D' T9 F0 K) d
var pausespeed=(pauseit==0)? copyspeed: 0$ r0 {% g S: Q# I
var iedom=document.all||document.getElementById
* U' a( f3 k6 F" Y$ w2 C# C- @if (iedom)7 a; B/ \; L' ]( L0 h1 L) q5 R( Y/ [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* |0 b8 r' l0 vvar actualwidth=''
6 O) x8 g6 S0 Tvar cross_marquee, ns_marquee
3 `# h& x) B/ Q0 [& Z3 @
+ G. K- i4 o# C6 h2 D+ Rfunction populate(){
# p( J& q& j/ P$ zif (iedom){
( z. |) o' ^ F) S8 z: X0 g9 rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. t- A- {# `3 Z7 ycross_marquee.style.left=marqueewidth+84 F, H& n5 K4 l6 s) S, \
cross_marquee.innerHTML=marqueecontent( }6 [3 t0 \6 T) v4 k% \3 H2 A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 q( ]- p+ M. a! b
}
0 C0 b }! _. g4 eelse if (document.layers){
1 s9 F" r3 `/ }, A$ V0 h+ o! Zns_marquee=document.ns_marquee.document.ns_marquee2+ h, v- ^8 T7 `+ X! Y
ns_marquee.left=marqueewidth+8
. r; |6 _5 j# k5 b6 m9 kns_marquee.document.write(marqueecontent)
" y# v6 F5 |+ o# q+ {# f8 Y/ bns_marquee.document.close()
\9 H$ P& [( ?' g! W+ \! vactualwidth=ns_marquee.document.width- t5 F+ U* \9 W5 ^& I7 t5 v0 T0 C" O
}$ p1 l. z i# s- D: Y/ A g1 }. V
lefttime=setInterval("scrollmarquee()",20)% j% c* c; \% v/ l
}+ x% n* |' q* c7 H( s- v( j
window.onload=populate
- O: w, P% ?6 W. h& ]
0 P" m$ ^0 W6 ]2 a! B. k1 rfunction scrollmarquee(){
! E t% c% |' q$ q; Jif (iedom){* E9 i: P4 g) L$ c) N5 t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# G! |/ K; h* | d( H, ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 E& |% W* w$ z' L1 Eelse0 T3 E2 v0 m3 I0 ^0 M; B
cross_marquee.style.left=marqueewidth+86 S3 R' k# }5 @' H' t
. [4 S: j/ a, Y( k' Z
}
, ^ M( J* S7 E& j G( S4 Belse if (document.layers){. ]8 _4 K6 b- Q# p3 N7 N+ x" X
if (ns_marquee.left>(actualwidth*(-1)+8))
1 m4 C3 _ e5 g, D9 [9 Zns_marquee.left-=copyspeed3 B, e7 ~& }$ X
else
8 R* @) ]0 w4 Bns_marquee.left=marqueewidth+8" |, ^9 b4 T0 I& X# ?$ \
}( f, f% w6 K/ K6 C8 v0 t1 r
}
, o( }/ t: d( {: x+ z7 O- s+ }" p
if (iedom||document.layers){
- B0 z$ @1 ?9 H7 d/ e; E& hwith (document){6 n0 B8 _6 W9 m4 b- l$ ~9 O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 o P; c& v% L; E ~
if (iedom){6 i( B9 }2 |* c5 p; S- T6 T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). x& `0 z, R+ H3 ]3 M
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 R, o/ Q: T7 C3 S0 ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 i8 B. }% O. Y
write('</div>')
. H/ j$ U9 E7 k8 j2 I}
$ _. a9 H/ N* w4 Aelse if (document.layers){
: g' p/ p( X5 z- D/ r: \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* s3 S. K8 A% Z5 l, I$ v% }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
N+ k! {/ P: Y0 M# U" e' Wwrite('</ilayer>'). H3 _3 _; Z8 f' ?( Y, x
}
+ ]4 B8 o7 Y6 O9 F8 p5 Z2 I/ W5 \document.write('</td></table>')# B) E& [ [. G9 c$ S
}
* O2 L1 s7 u, b% D; m. u- f6 l}
7 {- r0 a0 ^ f2 x; W$ a- A9 A</script> |
|