返回列表 发帖

网页之跑马灯文字特效

//修改宽度. ~( o3 J0 {7 F+ r; l
var marqueewidth=3007 @# j% X4 {% |: s. W1 T: O9 a3 \1 G
//高度7 M0 L7 D% o3 A+ K
var marqueeheight=25  L+ A7 G" x* f& d/ }3 f; A" i
//速度(1-10)
2 {3 o& {# \# m/ Wvar marqueespeed=3/ q& X/ y5 J" h2 B+ x
//背景颜色
7 P' }' F$ z" b% Z# t- D( nvar marqueebgcolor="#FFFFFF"
; s4 U" S; S# Y- n: R& v//是否能暂停 (0=no. 1=yes)?
4 b. j* s* D7 F0 f, @var pauseit=1
. L3 h4 r+ g" b8 B
' t5 W1 f5 k) Q//修改显示内容
3 C! C5 ?: A$ k+ c; o- N5 K$ ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! k; E2 O0 A( r" X: z

1 Z  O7 ]5 ?8 I+ c  Q- ], g: P' L
////下面不需改变////////////
6 E  `9 \0 I$ M, C. W, z; A; G1 K
: |! e1 a  `* vvar copyspeed=marqueespeed6 ^- c+ O) E+ N3 J6 V/ z2 r
var pausespeed=(pauseit==0)? copyspeed: 0# E+ I, H  ~# L( c6 \4 R, U7 Z2 w
var iedom=document.all||document.getElementById
" b' D. P9 N: Vif (iedom)
8 Z/ J' x9 D8 pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ T9 W; z" W2 I( e) c) G/ _+ cvar actualwidth=''
, k  Y9 _7 m) }) m0 Rvar cross_marquee, ns_marquee
& C- \3 g7 G( E4 r0 [- I
. H( L; {/ J% e6 S# D" `function populate(){2 Y# R+ n: t. q. u) g3 D
if (iedom){  s1 Z' D0 _1 s4 y9 C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" U8 }+ M8 U9 _* u% Ucross_marquee.style.left=marqueewidth+85 d5 A/ G9 q4 E: a+ n3 g* B
cross_marquee.innerHTML=marqueecontent/ l) k7 q7 A; W, W" o
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 D( d* f6 a3 ~2 c& N}* |* v4 e! Z; z2 v% j; Z9 ^& L
else if (document.layers){
: W5 c+ @9 K) W% J2 Ins_marquee=document.ns_marquee.document.ns_marquee2
. Q3 x9 C9 C- h- y/ m; o% @ns_marquee.left=marqueewidth+8
- [  S8 b) d4 k8 w4 o2 Z: ens_marquee.document.write(marqueecontent)
4 l# k/ x$ l" A" r" j; r) c" D  sns_marquee.document.close()
; z. e  h5 I9 d% Qactualwidth=ns_marquee.document.width
2 h& d9 D/ w& A6 Z- m}- H" I0 l4 s: U2 X( M
lefttime=setInterval("scrollmarquee()",20)# Z* v+ R  ]2 p6 m, l2 ~
}
  M1 I( x- N9 t* m0 Pwindow.onload=populate) t2 j2 Z3 H& E2 I# d4 n7 i0 E

; K' T- B8 |' `$ Wfunction scrollmarquee(){0 d5 {4 {2 }7 C
if (iedom){9 r' P% c6 R) A+ _1 K. Z0 y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& P; s8 c/ @- q5 I4 J3 o$ X6 _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. Q2 d( ]+ Y7 Y9 Y
else9 U( ]/ R* [; W
cross_marquee.style.left=marqueewidth+87 e2 n6 D' O0 J
+ J; N  p+ u# {9 n1 \8 D( O' q
}4 _( ^6 U/ F: p3 p! c
else if (document.layers){
4 p" T% |  s2 k1 q% Bif (ns_marquee.left>(actualwidth*(-1)+8))9 b0 D; w8 M* Z6 x- H( `: k
ns_marquee.left-=copyspeed
2 {$ \& W- u; w5 H' t8 K7 Relse% P- F- q' Z3 ^3 l/ W
ns_marquee.left=marqueewidth+8- c2 k8 ^: X: M; K
}/ @' J) Q, _: b  H
}# Y# L  d5 G; q6 T$ V, Z# B
0 m5 `3 ^8 x1 ]6 x6 X0 c, N; c0 x, O
if (iedom||document.layers){
# A! N/ g% L$ ^* X- l7 zwith (document){- G7 r- H5 h# p& e* x; I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* i! g0 L8 w- m0 T
if (iedom){
9 Q& _) `/ p; s, _) _  |7 Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 h7 v- m+ B( Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& \0 q0 y' s4 k* I
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 g, p( ^+ ^9 o' h* mwrite('</div>')
' ^- T+ n6 U2 o+ E" ]}; j! j6 q& @/ {& Z# w
else if (document.layers){
. v0 |. @% P' W# m+ L, rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ I8 k7 q+ x5 i. ^: ^  R" E. _! a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* g0 m0 |: S1 t3 G/ Z( d  b
write('</ilayer>')
6 D- t0 I$ E! Q+ o! {2 w}% Z5 V; p. n" ?+ e: I7 o$ ?) `" t
document.write('</td></table>')0 _% m$ R, `& r; |) b/ X
}
9 v3 g7 s( b5 i  Z) i" X- w}' T+ W$ ?3 W& y. O
</script>

返回列表
【捌玖网络】已经运行: