返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# }, M# m2 C8 j+ A5 b% R$ M. Fvar marqueewidth=300
# [  [3 l& ^, W* G% j. L//高度
$ w8 I5 [% c) q) N- q) Tvar marqueeheight=253 P1 x2 j/ v6 ~" y' T
//速度(1-10)
8 [. h0 v) s, ?var marqueespeed=3
8 C3 K/ \" T% E7 L3 M//背景颜色
! g2 T6 ~% X0 n  U' C# bvar marqueebgcolor="#FFFFFF"& q, K9 v! L/ A0 |5 t
//是否能暂停 (0=no. 1=yes)?
0 \6 Y2 v3 J3 k$ h' c, {# ovar pauseit=16 D9 V4 z: ]# ?5 Y, E1 I
/ e" q, K3 |# g
//修改显示内容
5 T. D1 C) C8 w# rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 T# E+ \+ |1 n( F

7 N8 H* u' w, t- D, E3 p
& _* z' I% v  v* e1 G# U0 a* ]////下面不需改变////////////' u9 O# b4 Z/ V1 k; k6 q

, J2 q6 t; z: \  T8 b& ~, z7 |! M6 evar copyspeed=marqueespeed' I* ?) j6 i# k9 F4 G# C
var pausespeed=(pauseit==0)? copyspeed: 0
" K* \9 a8 Z. O0 R9 P7 I# Z/ xvar iedom=document.all||document.getElementById; ]" J/ i1 E- Q
if (iedom)
. ^" D6 U7 x1 w" L6 Y2 Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, L1 W# @, W: ^3 c) V/ mvar actualwidth=''! L$ r: d) N, v: d) G
var cross_marquee, ns_marquee4 J  `, _- s- E5 H( P# M/ P+ r( f2 n
7 }) {/ k- L% Z" H& d
function populate(){4 j4 A7 m: \2 I0 b9 }) r: c1 H
if (iedom){
* S# P7 ~, w" qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, p( e# e6 {- S2 H; B: Ecross_marquee.style.left=marqueewidth+8
! _. o. E& y% ecross_marquee.innerHTML=marqueecontent
7 @% [4 F4 ]/ ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- f1 Y% G$ L2 W3 z- Q
}6 p% V/ b- F0 ?5 l  p: j- N
else if (document.layers){
" w4 q# F8 J# D; d+ `4 [: Pns_marquee=document.ns_marquee.document.ns_marquee2
$ T" p: @/ y0 O+ M/ }2 {  Ans_marquee.left=marqueewidth+8
& `2 V7 [: q1 dns_marquee.document.write(marqueecontent)3 W5 I* y9 C$ L: {% t4 X2 \
ns_marquee.document.close()
$ v9 M0 F! H) |7 f7 h$ I3 Kactualwidth=ns_marquee.document.width
; E" p* e: K5 b( B. y' D( Z# G# D  v}
5 e) [  C' R5 slefttime=setInterval("scrollmarquee()",20)$ v+ v3 N) [& E
}
) c$ U* `1 e8 ~. b7 L4 C& qwindow.onload=populate
, h) c  z( P1 c9 I
/ j- b* N( ]" v9 S6 q& {function scrollmarquee(){
5 n; y. Z- Z" ], ^* n- W( q9 ]if (iedom){
2 h6 c. U6 z* Z* v6 V0 z$ T2 Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 M% F1 h+ l9 E, m4 d6 t2 o- _" w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! ^. j8 ]* F: nelse; f# O( w0 C; j, w: L' A+ @
cross_marquee.style.left=marqueewidth+81 C$ L' W' h; U# O2 R& ]+ F
6 d: ^4 O6 O5 M
}4 I' a7 z; {" B/ y
else if (document.layers){' b  w- O% ~+ ]+ j
if (ns_marquee.left>(actualwidth*(-1)+8)). I+ W! G3 e0 w1 H
ns_marquee.left-=copyspeed
5 z. O9 L+ N* felse
  B, p; h* X% o& ons_marquee.left=marqueewidth+8$ t/ j1 `. v+ ]2 ~5 k4 Y% G4 B! f7 x
}* {2 d5 I# h3 ^  ^
}9 D9 }  g& q( U1 Y& R  L
; q# U' |6 L, A; p& l; Q3 Q
if (iedom||document.layers){
/ V9 d  }$ r( a9 N  e* q1 Ewith (document){
# Q" }4 Y. _) ?4 \6 h. Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: K2 n# f8 O- D! _' hif (iedom){
4 h$ p, Y, k7 e7 c( z8 N5 }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" A4 |6 F3 H1 B, K0 Y6 D
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, W5 k2 ]) [( M1 U* X; @1 t( swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% {3 E9 I7 A- U6 C  G3 M: Y& K; B
write('</div>')4 {2 n' d  S1 A  T1 y6 e* Z/ N
}) \4 ^/ v+ ?( a( W
else if (document.layers){
6 l5 g2 K" J# C$ x( swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 K) S- b& `2 q2 Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- L# ?. J4 X0 `) ]write('</ilayer>')) P. x3 X& u4 ]/ p- O
}
( g8 k  ?  w! M; _7 mdocument.write('</td></table>')
  o$ b- P+ H: d8 B}
7 T8 G/ O( B+ ]' S  W}
+ W+ X) P. X2 H2 O</script>

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