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

|
网页之跑马灯文字特效
//修改宽度% P) s. R8 b. L( |
var marqueewidth=3008 l" F. H0 G2 L2 R6 r% t1 }9 Y9 e/ T
//高度 {0 ^1 z7 C3 r. {
var marqueeheight=25; C) B C3 B2 c, ~- Q1 m
//速度(1-10)5 D$ z! z3 Z8 \5 @; P* H
var marqueespeed=3
8 `% j( s% d/ z" [3 _9 z//背景颜色 A2 A# V' k0 `/ U2 Y
var marqueebgcolor="#FFFFFF"
$ w4 u& v' D0 d/ q) T2 w0 b% c2 l# ]//是否能暂停 (0=no. 1=yes)?* h$ T, w3 S8 f5 E8 F
var pauseit=1: a; Y9 V* ~0 {4 w5 X; c
' z7 Q" L, T! O, z' s9 h- g//修改显示内容- U: Z" I; B/ o/ @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 J) ?+ L) c" H+ O- @1 ]0 J8 g; t# | m: W3 E c* Y5 Q+ M0 A
" @8 Q3 S" |' u' y" |////下面不需改变////////////
2 K! z! O1 w' q% H
* t& z0 }, G4 ivar copyspeed=marqueespeed5 C% L$ X) j" x$ o6 u' S3 p$ V: d3 {
var pausespeed=(pauseit==0)? copyspeed: 0" Z, ^1 K& \+ { W% R( U. x4 p
var iedom=document.all||document.getElementById
* L( U, n7 Y, P" i' Iif (iedom); V q1 Y1 F6 |# H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); p- \& h( O. C& V2 O2 R1 ?
var actualwidth=''/ U8 }8 H; o& _- |
var cross_marquee, ns_marquee8 i( i9 w* {( w' P" L4 L( ]
5 B: X: F) \8 f
function populate(){ O+ e4 v+ P' h4 I
if (iedom){7 K; p, |8 S; `/ i1 Q- H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" D) W8 o" w6 l1 O6 N3 X. y9 y! ?; lcross_marquee.style.left=marqueewidth+88 U- o9 Y* e5 n) w* c
cross_marquee.innerHTML=marqueecontent0 j2 D+ N& V$ {% F8 f1 h7 t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% V9 W) s2 c+ j$ q
}
) \6 Q0 N, Y, `3 Zelse if (document.layers){. w" u4 \6 y( ]* t
ns_marquee=document.ns_marquee.document.ns_marquee2
E. P. l* e5 b7 A' Y( r# t4 n( {ns_marquee.left=marqueewidth+8" t! h8 r. j9 }9 `) D3 g' c( i
ns_marquee.document.write(marqueecontent)
! j3 F" ]# z* I# l, Bns_marquee.document.close()- X7 L$ p x/ G* J; T7 J/ K
actualwidth=ns_marquee.document.width6 Q p" E3 Y- o! ^
}
) \7 J) Q' y" s0 M+ Blefttime=setInterval("scrollmarquee()",20)
8 w4 g! y% i- _+ R}
' x2 B2 U C* Gwindow.onload=populate
5 A, D& t/ n3 l8 x% ?/ e+ l1 g, k8 F
function scrollmarquee(){6 w( V4 D% A6 j5 @$ q2 k
if (iedom){# ?; {, z6 x5 K! r& j: t/ |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) p4 R" z! n2 p7 Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; ^! x$ v* ~" Z( b c; n6 _0 @
else
' j. x5 {6 k+ W% S9 Kcross_marquee.style.left=marqueewidth+8
! U7 J' W' k3 y5 c, n+ e7 D: p4 t4 K3 A& X( ]& z% c
}3 ?8 R# a' J0 ?" b
else if (document.layers){
: D! k5 X- Y0 j- O# |3 a9 {if (ns_marquee.left>(actualwidth*(-1)+8))
+ e' D5 X# A& w+ uns_marquee.left-=copyspeed
7 `: o* M$ T1 r Welse
2 U' ^9 b+ l5 ins_marquee.left=marqueewidth+86 |7 m- ~# ~! P8 m4 U9 M
}: ^6 ^( b3 i7 ?/ i9 }
}3 E6 G' b& H% u' M; U
0 ~0 r* ~. ~& b2 J8 b, Z3 O
if (iedom||document.layers){
0 z; k, F p# e: c' o- V0 Vwith (document){
' H4 S! \& O) j) O) W8 d- @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 b1 h' K) a& V, g& tif (iedom){ i. }; t0 G8 f5 C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 \$ j& A! U+ O- n" E+ {! {) ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ v' }5 j9 @9 ^: I, g
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 s8 B5 d- h6 d( ?) v
write('</div>')
# Z: a+ C; E2 d* R( M; D}. A( G# O. Y- `1 C3 W) L) `# Q( ?
else if (document.layers){! U8 q* D. [6 O: T+ }! f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( c1 M. o. P; e* \( N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% w& h1 f5 T% I) D' E3 Z2 w) }1 Awrite('</ilayer>')" ^4 s7 `' _1 r- f- I( x* h5 \
}- o5 k$ \/ D2 h0 r4 F
document.write('</td></table>')" a5 {8 u |* }& V+ E7 C
}
: p9 q( z) o( g, y( L4 d}
{+ f: L* J( L" {5 }$ H</script> |
|