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

|
网页之跑马灯文字特效
//修改宽度0 q+ D' f4 @+ N% \5 d7 Q$ d" P
var marqueewidth=3002 i5 N# t7 }3 K% N2 }0 X* G
//高度6 w" ^4 d( E, N2 w6 `+ d0 ?
var marqueeheight=25$ N _) c" C j
//速度(1-10)" G' E' L" Q5 Y7 V) n. ~: _
var marqueespeed=3/ U5 B+ o+ y0 ^+ f" U' y
//背景颜色! |5 A3 O! F& D) q) f
var marqueebgcolor="#FFFFFF", ^9 l8 x, l0 |9 W+ t
//是否能暂停 (0=no. 1=yes)?
" A7 k- w! ~3 g0 tvar pauseit=1/ F N, j, C$ w" _" s8 N
" O& Q( }, `5 c6 Z0 C//修改显示内容0 @, l) {5 J; e* k6 m( ?& x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! ?0 y4 [" Y* s8 W! [ {4 m
7 J/ s+ n4 M7 b# ^- G4 \- l5 G2 A! D8 L
////下面不需改变////////////
! ~# j, p$ r8 }; [5 G! `7 V8 g# V. P( N) z0 A
var copyspeed=marqueespeed5 W9 K0 I* I. u, ` u: T' w, q
var pausespeed=(pauseit==0)? copyspeed: 0- L/ P0 s; S/ F2 M/ \/ J2 {
var iedom=document.all||document.getElementById" G' W0 x+ s J/ j3 ^, y8 D8 Q
if (iedom)
- e4 C0 z2 u- O4 A$ p& \: Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). D$ ~0 r( |% i2 H
var actualwidth=''
( Q9 G$ v2 |% M# @* J' q4 ]var cross_marquee, ns_marquee
( u4 F* ]1 y9 X6 H e
, q+ A( k4 a* S7 E: B6 d1 E/ \function populate(){
0 ^! p8 |+ r' k- z' qif (iedom){3 j# ^7 h4 u: j0 u7 X9 r( Z t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% y7 A% x f; \
cross_marquee.style.left=marqueewidth+8& b, t; L- Q8 C. e/ W7 V
cross_marquee.innerHTML=marqueecontent, b1 h: l8 d( z, d4 G
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& A& ~+ L1 N( |. M9 w0 f, U}# C# m7 x+ ] ]5 i5 I! @
else if (document.layers){7 H4 H( P' y4 i! ^: v- \+ a
ns_marquee=document.ns_marquee.document.ns_marquee26 ], Y$ } ~) H5 p
ns_marquee.left=marqueewidth+8 k2 \4 Q! [" s
ns_marquee.document.write(marqueecontent)
0 M: ~* N& {% [ns_marquee.document.close()' P6 {# k5 N4 T1 y4 {# t7 p2 P
actualwidth=ns_marquee.document.width
! X4 ~# w) f* Q9 n( q0 H}
6 \- b2 \- Z" C4 F# j! k* Elefttime=setInterval("scrollmarquee()",20)
& m2 p- N- ~- p& i0 {. t4 ~5 r}# D) P+ c: u+ C* c4 Q8 q X @
window.onload=populate
/ N N1 W/ D" p4 C; s' T, k
; D7 F! z; \* b7 J- z, }4 f; }0 vfunction scrollmarquee(){% Q% L( B8 V% V3 ^
if (iedom){
* I A# f& p+ F6 U5 T/ R+ Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). _5 U+ n& V: c- x) X& |& B% b. P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, ?& T% G8 O0 N: Y4 `! G/ m" ielse1 I: q. P. ~" x9 Z4 ^ { { i
cross_marquee.style.left=marqueewidth+8
0 ^8 O8 t& N5 |% o
" W% U5 H: b$ P6 ~: U4 H}
2 i' y# z* R6 d, I S8 x2 L/ qelse if (document.layers){2 V# S8 _" M0 `, U) q8 b
if (ns_marquee.left>(actualwidth*(-1)+8))4 G5 O' j- h( m, H* L
ns_marquee.left-=copyspeed+ z+ N" D/ `1 ?2 z ^: h
else' _9 ~. i5 f6 V( M4 p
ns_marquee.left=marqueewidth+86 n* @$ B* S2 n3 p
}
4 @" k& \6 Q( z& _2 u0 n6 @# ~" }3 v}3 h ~' N( Y/ F. h+ W* ~
. ^9 e l- l9 ~' ?
if (iedom||document.layers){' j" p" ?1 A& G5 B7 n# r
with (document){- R2 J. x, c: n9 n. {. ]( a: `1 ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( L0 b" x3 u: S9 C+ e- Y1 d" v5 Bif (iedom){# u9 k1 ]+ y$ G# g/ K" c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ w+ f% w3 j2 W- o& ?0 g. n& g( h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 @/ N9 B! |6 ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% J Y) S4 Q5 s* h1 P1 [write('</div>')
% S4 |5 |5 S. i G9 E' {}
4 }" @. w. g1 o! j9 H: helse if (document.layers){2 G! n1 j) k5 u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! k. I0 c: L C& L% W* z( i k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& [3 }% ~2 |3 U1 I( l# ]+ d9 v5 z. Lwrite('</ilayer>')$ |' ~/ F0 A. i7 g9 c
}5 Q' q) L4 V/ b9 [' ?: P& c" F" {
document.write('</td></table>')) T5 s3 f) p" e& B' `7 }$ k& K
}! m+ O5 r0 N4 S+ J& X
}/ s- R) s2 n2 g* Q# L
</script> |
|