返回列表 发帖

网页之跑马灯文字特效

//修改宽度" V& G1 G' F% c; K
var marqueewidth=300- `, E3 u4 _$ h& A* k1 S0 \& Z
//高度
" \' Y9 }% A- qvar marqueeheight=25
6 m/ |! Y) N3 }//速度(1-10); d1 U0 ]  s6 n& `" J8 N2 i
var marqueespeed=33 K- q8 Q) V9 ?! h
//背景颜色
, M; V+ s9 K8 |1 V# ~+ ]var marqueebgcolor="#FFFFFF"
$ `+ }* j; l: P& L//是否能暂停 (0=no. 1=yes)?
# K. o$ [9 Y3 P6 C6 |/ Rvar pauseit=1- {9 P  ~: ?9 j( v, ~! k4 O

0 m8 n" S/ e3 i, d' w7 _0 o//修改显示内容
% @  N8 p( A* x" R3 B7 v' Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 X4 X: j6 D% r
' d2 U+ v$ Y+ O  `% \9 i
1 z8 T, k$ a. _
////下面不需改变////////////
# l# K6 v0 w3 G3 C! T& E0 ?" z8 u+ G" t8 {9 \+ N/ x. M9 y% ?$ F
var copyspeed=marqueespeed
+ y2 ]- c4 y' b1 C% G) svar pausespeed=(pauseit==0)? copyspeed: 0
5 t; ?1 e/ Z7 f1 Wvar iedom=document.all||document.getElementById0 b$ w& t  C) U& d: l
if (iedom)
5 {6 P0 Y& t( U4 @% N+ X3 idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- }2 R) v8 A( B7 |( j' B8 [* u
var actualwidth=''
0 M0 y5 b& g0 q0 Ivar cross_marquee, ns_marquee
3 R( i- D9 B. |& Y" k) B0 \/ _  X7 M4 r/ f1 U1 @- a6 C
function populate(){. D/ U  Y6 Z% j" f7 v% O  j! Q
if (iedom){. j' x% U% `" X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) M9 V+ b$ `% p- Q2 Ecross_marquee.style.left=marqueewidth+8
/ v) D( e% Z: {( P# Ucross_marquee.innerHTML=marqueecontent
) B% J/ h9 a# I) L! Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& g3 e5 Z* B8 F5 R& r0 c' S}
" H* }& Z* g' b$ L# |else if (document.layers){
$ t& q) v( `& r, z! hns_marquee=document.ns_marquee.document.ns_marquee2$ `. Q' t/ u' e* M7 d8 L# h# j: N
ns_marquee.left=marqueewidth+85 j- }8 Y7 o2 Y' p3 g7 r! ]8 j% e
ns_marquee.document.write(marqueecontent)
) Y$ v; T2 Y* U3 W8 \" g" zns_marquee.document.close()6 I0 }! R) y# k& W2 j) \
actualwidth=ns_marquee.document.width, h8 @/ Z8 y  _' B9 k  c+ u
}
3 Z0 H8 _( W/ S& Ylefttime=setInterval("scrollmarquee()",20); M- t% |* H6 ^& R( e5 p6 G" o
}
$ q' u, N7 k- s( Pwindow.onload=populate1 u8 y/ ]5 U* P3 G% z( u
# D" M  O- x. A5 d) n( I$ K' Y% N7 }
function scrollmarquee(){
3 O: m7 G" e) E8 U1 O: `: Q8 Bif (iedom){  y8 |' M$ a1 _6 Q7 H" q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 m# e# r1 f4 E# i: s; Z9 F9 ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 B: }3 x: v$ w8 O1 @5 O* H7 x; gelse
' x+ M$ r0 w5 [' J; q  o" [cross_marquee.style.left=marqueewidth+8
% M. ^! Q$ G2 ]# i, r2 Z. y
$ g6 q# Z% w8 j/ {}
0 q% N+ @* t) D2 Y+ k2 L: J# Melse if (document.layers){8 u, h+ W' B* O& _3 N7 R+ p
if (ns_marquee.left>(actualwidth*(-1)+8))
7 J8 |( m. ^! C" ]  v  hns_marquee.left-=copyspeed" }  R: K2 _% P
else& E4 _$ }/ X- }1 n; D
ns_marquee.left=marqueewidth+86 m1 E9 g+ I0 b1 k
}
4 E9 j* d, r- Q2 |1 L) H}# x  B0 @9 u2 s$ H" r$ Y

- [2 H: \& B9 e5 H! \& aif (iedom||document.layers){
) F) q/ s# B  J- q8 Hwith (document){
/ Q; x: f+ Y( N' Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), P* M9 v: C4 Q
if (iedom){- t5 }3 I8 ]9 C3 H& _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): O' P9 h4 X: |* \: f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# R; |1 f# }2 @6 V' G, t) x8 G" ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 x9 m# v7 q- j: ^6 F& F9 K/ ^2 T! v8 Awrite('</div>'): j1 ^$ k% Q! ~: Z1 h
}/ \5 m6 ?! M4 k- t* P) z% H: t/ d
else if (document.layers){0 ~. f4 P2 k% w4 c* t4 K: q) o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ j- b  Z# b: C" N# h. o6 y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% O* E$ a9 o; R4 t
write('</ilayer>')
+ s+ m7 R" n5 h2 I9 N: Q( J}9 l& @# E5 \' V
document.write('</td></table>')
# Z4 d/ t# U0 x3 T; O( |( }}
$ Y5 w& v8 M  a: k}
: f' Q5 D6 W7 w7 F2 B8 E6 P  v</script>

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