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

|
网页之跑马灯文字特效
//修改宽度
: p: E& G% w2 ~" B. Hvar marqueewidth=300
9 e. l, z! P: k1 S1 R//高度
" Q. I" Q' V( Z6 r5 U2 o# Svar marqueeheight=25
4 M) z# F( a1 J' E//速度(1-10)
( R. Z ^* N7 j* `" s5 Kvar marqueespeed=3
) q& V$ ]- b9 `//背景颜色2 `; b5 k+ F! S2 ]% W
var marqueebgcolor="#FFFFFF"" v; W L* B+ Q: C p0 G
//是否能暂停 (0=no. 1=yes)?
. [& k4 Y0 L. s/ f7 `8 Rvar pauseit=1
1 }, J, h2 `" i( y' L
! h( t$ ` |( A- o//修改显示内容
: H! A# d: L2 w6 W9 E' }var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& H' `$ {/ G2 n6 O$ D( F
4 k7 l( x' {* l9 w( i: x* z b: P* b* F8 m6 k0 z2 n* M
////下面不需改变////////////! x7 G8 Y+ c8 V2 J! |
- D8 m( a/ z9 o9 s# M& B+ D" bvar copyspeed=marqueespeed' S/ D4 j1 u, F) g* ~
var pausespeed=(pauseit==0)? copyspeed: 0! {. ^ ^. h, A; @
var iedom=document.all||document.getElementById
! W* U3 \( J4 @( k6 L# e) Bif (iedom)8 ]' A9 D. T1 F5 f7 ~4 s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 K1 e K5 b( |# T) `
var actualwidth=''$ ]- ?5 z, R1 S ?4 |8 ]
var cross_marquee, ns_marquee1 D2 T( B8 o) S0 X% x; U% [2 P& X$ Y
) u. ~8 ~8 i* \8 b) O1 A$ @
function populate(){' J9 F6 ~1 j$ O% j0 G0 Q
if (iedom){
4 W' u; \& Y- y8 _9 S: K* {" F8 ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" r- ?8 f& |* Pcross_marquee.style.left=marqueewidth+8
* a- |# J/ I, B+ h- ], B* jcross_marquee.innerHTML=marqueecontent
. \; |1 g5 l, E/ L" _& qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 G" h+ T; b+ o7 F* b7 V
}0 W% Q5 t I0 {+ I3 @; X: Y7 }3 Y
else if (document.layers){
* Q3 a0 s- M" O( b; {: zns_marquee=document.ns_marquee.document.ns_marquee2
) K- |& n5 f# uns_marquee.left=marqueewidth+8
$ s$ I3 x0 e" J+ Z9 m2 \7 p6 m2 Jns_marquee.document.write(marqueecontent)
9 U3 i8 `( Z( L9 u+ D* }ns_marquee.document.close()
) Z3 k" z6 ^% g1 K2 S3 pactualwidth=ns_marquee.document.width( \7 z/ x- c( n( @. U: R- R4 w
}
* L* d/ V+ C" e: qlefttime=setInterval("scrollmarquee()",20): @& K3 s8 H( f" u+ S
}
3 ]# x. f& X9 Uwindow.onload=populate* Z d. r- r' G0 l7 u! M( I
# U0 {3 ]" Q; E: c( Dfunction scrollmarquee(){
. Q' V- q( Y5 \if (iedom){
$ n8 z0 y/ Z. _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* U7 O0 l, K2 w) u- R# n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ Z+ \" Z, y2 z( f+ w3 d! j5 n
else9 S, G8 g2 D* U# ]
cross_marquee.style.left=marqueewidth+8
2 r8 f" r' f3 y1 x/ l' \
5 r7 x0 D8 f, q( Y4 d}* h6 \7 n5 M; ?9 f) ^
else if (document.layers){8 J$ o. D! ^9 p9 O% ~, f
if (ns_marquee.left>(actualwidth*(-1)+8))
6 Q9 b# C' l0 @ns_marquee.left-=copyspeed6 E1 J) E9 e5 t0 H: G( l
else- A1 X+ g/ P$ t' m0 ]1 K
ns_marquee.left=marqueewidth+8$ v, h* j! }# h( Z2 b8 O
}
$ D f3 C' v# W4 g0 B0 E k}+ D8 [! c8 D: Q+ G+ C) Y
8 A6 G* {- A! @4 X) g( ?" m, n
if (iedom||document.layers){ F) i# e6 P V0 v1 j8 ?+ Q
with (document){
1 E# J% a' _; X- U$ O7 z1 Hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 P0 X' `1 h4 R) u
if (iedom){1 y3 @% {8 i' P& A9 e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 w, w6 B# E- [2 O% z9 f4 Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" R, s3 S8 k/ i1 F) S) q7 J% owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) x& w: n, b' P, Twrite('</div>')
U A7 T* d0 a* k. `. R}6 Q' q l8 d( I; o i- u8 G& A
else if (document.layers){% R0 o; i* S! z/ l3 O, [4 `
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 P# A8 M* a% G; T8 T' F4 B; N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- D/ O7 D& Q, S: I9 @write('</ilayer>')
/ B6 P" c$ F, F, L: w}) f8 b7 a- g/ p! t
document.write('</td></table>')
9 O( H; G* v1 e}
( [1 @" a- |/ D2 m1 Z7 y}
4 d! g; h& }# d; G. ~5 O+ b</script> |
|