返回列表 发帖

网页之跑马灯文字特效

//修改宽度
' ]( z. M( n7 }3 m+ o% _var marqueewidth=300- J  B7 B8 P! D4 @/ F3 h: A
//高度) ^5 h7 W' R5 ?0 q6 B% @
var marqueeheight=25
9 g" H  ^! g) Z+ W+ E! u  O" T//速度(1-10)
$ t: `8 g' {/ S; t" g  qvar marqueespeed=3; |4 O: F* d, _- w
//背景颜色( C5 s7 x1 P6 ?- g
var marqueebgcolor="#FFFFFF"
! C$ T; ~. f5 [  I* X//是否能暂停 (0=no. 1=yes)?
" T/ U( _  J2 ?& B3 dvar pauseit=1: v) ]% B: P. w% T

3 ~7 @) j/ Z4 X0 c//修改显示内容, `( C9 l  \. ~9 m* I7 w7 G6 Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* ^. J4 O4 a% v! h6 i" P2 P3 c

/ D0 Y: K( `# q5 y8 E' M/ W) m) V7 \( v3 c! j( |; G
////下面不需改变////////////
' |' K3 \0 X! a' A* x( V1 m/ Q$ U6 q0 e  u! r, V# L% ]* t
var copyspeed=marqueespeed
' Q% y" g3 y" X$ D0 A' e- B9 Hvar pausespeed=(pauseit==0)? copyspeed: 0; X0 Y" [9 w3 \! I3 M! D
var iedom=document.all||document.getElementById+ _8 ]0 L0 r% j& A$ v
if (iedom)7 ^- Z9 H& G  d$ o- ^+ D5 \
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). i: O/ w. G* F1 K! F. Q" Y0 w8 T
var actualwidth=''
  G; {7 E- T. b& b/ V4 X4 Z% @) u! Xvar cross_marquee, ns_marquee
" ^9 x, o/ t4 L/ j9 Z; Z3 [& D) o
: r- o7 w2 W. @function populate(){/ z1 h% V) Y- ^( X) T' M
if (iedom){
' H' U( n# n" e1 T) Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, m8 P; g" }  s1 o5 j. y# r
cross_marquee.style.left=marqueewidth+8
! Y' B( G/ u$ @cross_marquee.innerHTML=marqueecontent
* v/ t) W- ~! ^* ~/ N. Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. B, t9 p' q& Y/ m. p7 }7 d. G
}
* a& z! x2 n5 |7 m6 @' o! U8 ielse if (document.layers){, _/ r7 F; `7 y/ O) l. P
ns_marquee=document.ns_marquee.document.ns_marquee2& K8 G# d: t+ j9 M
ns_marquee.left=marqueewidth+8
5 G; `) t6 a. u' `ns_marquee.document.write(marqueecontent)6 ^# P. z9 e8 g/ A6 t4 O
ns_marquee.document.close()' V) n! Z' C$ Y2 H- ]& x5 C
actualwidth=ns_marquee.document.width/ g" i8 a; X0 l2 N: m  J
}
) o- K8 i% z# G7 Z6 e8 w# h9 x, clefttime=setInterval("scrollmarquee()",20)4 B9 {8 m: g+ {2 I) U; g: z
}  [: L( D- Y$ C' @
window.onload=populate) Z, m5 K( U! g* @0 {7 O
" d, L; ~. b# [+ y
function scrollmarquee(){8 ]6 O: i7 G: T5 t1 H4 d
if (iedom){
5 R7 f" I0 q' i$ }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 h# Z+ Y! ~, g5 \$ G5 v( |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 x6 F9 ~9 ~' g2 `6 v* i8 o% c
else
+ F" l5 d+ T) S( \6 Qcross_marquee.style.left=marqueewidth+80 W) H. T6 _! J* Q9 u

. {" ], E. V( h' [}8 M- e: Q2 a8 E' \
else if (document.layers){
) }& n' _" n+ }. G% W! }) W1 g% `if (ns_marquee.left>(actualwidth*(-1)+8))1 B7 ~8 K2 z8 s5 v+ z/ y
ns_marquee.left-=copyspeed6 I( k( Z1 f) ]/ W/ G5 ]% Z
else
2 X/ N. i" @0 |- ^ns_marquee.left=marqueewidth+84 x1 S; F6 U) |" C
}+ P7 e1 k! }: G, l9 r: X" L
}1 R! B: d5 Q& i* u" r4 q

+ s8 {4 Q% y6 d8 e$ Pif (iedom||document.layers){
' e* |+ G1 C, J+ _- l+ q+ awith (document){: {$ W7 S, M. }) y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ T" C7 `1 J% Y
if (iedom){3 y5 G% [6 j9 J7 C  R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- l5 o, m$ K6 Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& H2 T5 _) s& a0 x" }/ P2 Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' [: l  ?# g/ B; l2 Z% G5 lwrite('</div>')
' Y6 o! }" J) g2 ?. {4 R+ A$ p}
) c! p0 U1 X- ?  }7 K$ ]% \4 felse if (document.layers){1 D/ ?/ ]+ Q. n8 V. T2 I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ k8 H- M0 g" G: x6 v
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ X8 y# @0 `' w0 X3 t
write('</ilayer>')
& u' a- o/ t) p) f}
/ d) _" A6 G/ e; a) V; a1 Sdocument.write('</td></table>')5 J) f2 }7 Q8 E- f: K
}3 ~! J& {# j- i1 i
}3 P! f1 c- I# s- N* o
</script>

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