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

|
网页之跑马灯文字特效
//修改宽度
. Z! |2 y4 Y( U- J3 ~3 t/ H6 zvar marqueewidth=300
0 e/ ^& ^- s! K" R$ P$ X5 ` ]8 K a//高度; M5 W/ B2 @; t9 K
var marqueeheight=25( `+ X: S5 u, z+ S/ z* j5 b) K
//速度(1-10)- S: n( o* y4 }. U& ^: P
var marqueespeed=3* }0 I' ^. n: }/ u
//背景颜色/ }$ Q I/ n) G! p/ _
var marqueebgcolor="#FFFFFF"
W' M- w, k7 m/ v% t; g0 T//是否能暂停 (0=no. 1=yes)?8 a& A4 r" p( U7 g% u* n3 ]( R
var pauseit=10 M2 P L& o1 v& V3 O$ a4 M5 M6 o# L) [
. p( {+ s2 Y$ R. |//修改显示内容$ ]& `: q4 k4 C1 e! _3 U) v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 L' z* N( V% O# t: g, t! u
' x8 a- I" u7 u/ p$ Y% n0 f' P6 N: p8 {
; ]% y- u9 V: {# V8 o////下面不需改变////////////
1 x" V$ l- `; r2 D1 v. L( K5 j6 n, e% M/ h' W2 Y$ z* L! V
var copyspeed=marqueespeed/ E; M; x7 I ~+ ]3 x
var pausespeed=(pauseit==0)? copyspeed: 0
6 M. S2 x1 N/ g' U5 V* s( ]5 S! Xvar iedom=document.all||document.getElementById& {/ {& d! ~! d% w
if (iedom)
& j9 ~/ p1 \% ]7 s# T& }/ O1 P/ |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# [8 w# v! T" Z
var actualwidth='': R5 d3 g: h8 F. Y; u" z
var cross_marquee, ns_marquee
: ~8 w. s/ R( T1 ~0 l9 a/ v# b% a% q! O; ~4 a, |
function populate(){
5 `' C; x- P- ^1 ^5 N9 m. jif (iedom){
1 x5 o& z ]( y4 J/ k( Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ V% n9 C% {1 X4 _1 N y
cross_marquee.style.left=marqueewidth+8
$ a5 b: Y3 w! n; xcross_marquee.innerHTML=marqueecontent
. f, _3 H. b) [$ C+ d' ~2 Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# `- `( p% p/ r4 [} G- c2 @* n$ n$ F
else if (document.layers){% q8 m p* D* c. H3 x
ns_marquee=document.ns_marquee.document.ns_marquee2! D1 j/ ~) }2 p1 t( k
ns_marquee.left=marqueewidth+8/ J# C- ]1 b' G7 K& ]- o! s
ns_marquee.document.write(marqueecontent)
. m) F) c3 L5 Ens_marquee.document.close()
6 C/ ?* v% x1 V2 d8 Xactualwidth=ns_marquee.document.width
7 W/ R$ G. r* }# Q' b% a}
( m/ B. b7 b! C$ |6 W- Y5 D; Q2 @lefttime=setInterval("scrollmarquee()",20)
6 F- p' x y+ w6 ?) Z}
8 c2 x9 t/ j* kwindow.onload=populate
) `$ P) N+ U5 D# ^' d" z4 G9 i" U, k) J. @& U* S9 y& y9 h2 ]# t! o
function scrollmarquee(){% ^) P3 `# g' f. I+ O* k
if (iedom){
! G) u! h6 _# V+ i% ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 c" \. M8 ^' g9 Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 G/ E. p: E5 |* g) s" X0 belse
" s3 B' B1 S) t( J" vcross_marquee.style.left=marqueewidth+8
2 e1 w0 Y) t! t6 y1 o/ K ^' v' B7 C4 C {/ |
}6 [9 o @: v8 a- D8 s8 x) _
else if (document.layers){& N) M6 h. {1 B# O+ l0 E
if (ns_marquee.left>(actualwidth*(-1)+8))# K& } _) W/ J6 t
ns_marquee.left-=copyspeed
3 ~9 ^& G" G; |9 ]: \5 D! t8 melse% L2 X6 j" ?' B3 b# a
ns_marquee.left=marqueewidth+8
3 F& X! T! }( p7 s}! o/ z. ^( x# ^
}
2 b$ t4 K+ v! j9 a& s( Z f7 W! a& J+ U2 V4 x8 k
if (iedom||document.layers){4 A, K7 R; ?* b
with (document){
' b- ^/ s% `5 ^3 f, p) h2 M5 {/ sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: {- }: C5 j: X: m u0 K: Vif (iedom){
2 o$ l' O: {# v6 A# lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 E- U* E3 T$ E. `( m1 @4 O9 s, w- D& Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 a3 f9 C+ J9 m7 B% {2 ^! B# K8 `( d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ Q( R$ Y* |2 ^" Y: y
write('</div>')
4 T' i2 ]/ R {+ P( K* ]3 K}
# S O# F& M: U# T. b* w0 F5 Q. }else if (document.layers){
8 i( A$ x9 _1 L7 @4 \+ Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ J% R7 _& D4 `6 B/ M; B1 L! U1 P' nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ ]( A% R0 M( x5 Swrite('</ilayer>')6 U. G( U0 J4 |8 _
}
$ u! i4 x+ |- x0 ]document.write('</td></table>')
3 q% q3 Q/ n2 O/ X}
( b# D& E/ x5 v}+ y! z4 A' h/ h* R( h
</script> |
|