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

|
网页之跑马灯文字特效
//修改宽度, O% Q3 o& x7 f# a& L
var marqueewidth=3004 \1 G; N' X- p" d4 q- P/ W3 Q# u4 d! p
//高度
9 f# D! u! g, M4 D3 i# _' `- l7 ]$ {var marqueeheight=25
W( t! L p. W$ n5 @( L) N//速度(1-10)# A1 m5 H1 h s# t4 U2 H) e
var marqueespeed=38 M6 M; H0 @% C* q0 Z" i
//背景颜色3 L' @* m. p U& M1 f& ^$ P2 z% J0 }
var marqueebgcolor="#FFFFFF"7 }+ e( b" S, w7 b( |
//是否能暂停 (0=no. 1=yes)?
! M4 z9 K i# C S3 w# Yvar pauseit=1
& N2 H2 {: f9 s& c5 N& u, d' Q- Y9 m
//修改显示内容
4 T" S; e4 k) G3 i6 evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 Y8 n$ [5 v& L/ t2 v, X t
u( _" r# t# z! {4 d$ t* e3 \: p! I
////下面不需改变////////////, ?% s1 T( M. I2 @" o
7 S% g- E8 z8 |' |var copyspeed=marqueespeed
" I, e% D C( P" Ivar pausespeed=(pauseit==0)? copyspeed: 0& L, a$ d4 q, U4 A
var iedom=document.all||document.getElementById, {/ C3 J7 K9 c! s# d
if (iedom)3 t3 o3 b" y, c @! ]5 I" H, h' T, Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) f& A( A& n& P9 u6 Z
var actualwidth='' D" W$ I$ D- A
var cross_marquee, ns_marquee
" i( ~1 G; M, D$ ~9 z- [* h" M2 Q' B" x" c3 C: J# v4 B
function populate(){+ s6 Q3 a8 T" k* s
if (iedom){
3 x h, O, U3 D4 v9 k/ e7 Ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 x( N0 T P! v+ d/ G$ m! Ycross_marquee.style.left=marqueewidth+8
7 u* Z" |# j$ r& M8 \cross_marquee.innerHTML=marqueecontent4 M6 M: k$ R3 z3 A6 s8 r) e4 [/ M! }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 H t( `9 }' h }7 T
}# V1 C2 @; T! \6 D% r
else if (document.layers){
7 d/ j' T& ` N& j* c4 v; ons_marquee=document.ns_marquee.document.ns_marquee20 u1 l* O% y3 C# A
ns_marquee.left=marqueewidth+85 r& _: c* V) M2 V
ns_marquee.document.write(marqueecontent)
& V( w. n" C: f" g* m0 z4 I0 X" Mns_marquee.document.close()
/ v% j2 c1 T& Hactualwidth=ns_marquee.document.width
5 u6 W& P0 i2 h) a6 V}
1 g; E0 J% F3 x9 T- l5 c8 Clefttime=setInterval("scrollmarquee()",20), O& g( ^" J, @1 ~1 v
}
3 @2 Q4 h# T1 |# w& N2 j* Lwindow.onload=populate
/ o+ p' w* _3 c
2 }/ h# ?9 V" x5 O3 n0 hfunction scrollmarquee(){
' a$ v! u7 r; { s$ }) Yif (iedom){4 _5 x4 a( _' b. ^4 l7 \* ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! B+ g. B U) I( T% C" U! vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" g; T# S% a# e! J3 ^& ~
else
1 ?( [. ]; h2 D5 Fcross_marquee.style.left=marqueewidth+8) ?# z; {; P0 U; N d
) O. u, A: ~; d! f}( U2 x* B. D! Q1 r" U" }% L
else if (document.layers){
* e3 i. T; ?/ l5 Tif (ns_marquee.left>(actualwidth*(-1)+8))
; |* j" T5 F# `ns_marquee.left-=copyspeed: V+ P* w _) \
else
! V: \3 |7 R! B3 g' Ans_marquee.left=marqueewidth+8! x3 ~& I0 q6 v, |+ p" G
}) p9 D8 H D. S V
}
; ^: u; j2 A3 r. s2 m: ~8 K! s
* O; ~- d. h2 v# F/ m0 Uif (iedom||document.layers){
# X2 H* s7 { }2 ~( twith (document){ f# }7 R1 d! A- c, s5 N) k% n
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" ^1 r* D# C- |* h4 Q1 k
if (iedom){! O! A+ r$ x# q9 n1 y, ]+ J7 a; Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& S. v P. p u' w" ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ B2 g9 f/ i( Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! y. a) A- y! [
write('</div>')
5 w' W' r' t9 a}
! z5 ?3 M, c# F( f/ H, Q4 S# ^else if (document.layers){
; ]3 n9 Q" t! Z: C& i! Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 J1 q3 I+ A: t+ P, Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 B8 a O1 @1 T0 `& \- A$ Hwrite('</ilayer>')- `) b9 k0 t+ i
}+ u- U, l) r! u2 g0 S0 R3 s; E4 F- b
document.write('</td></table>'); s/ I3 A. @8 @% W% _* i" i
}. k5 z5 p3 X8 ]& b( Q! U
}" _& B# |! X0 R% s0 Y/ F' T# |" j0 Y
</script> |
|