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

|
网页之跑马灯文字特效
//修改宽度9 i0 W) }6 I0 e9 D' W/ Z, t Z
var marqueewidth=300' x/ W( l2 u4 a1 [# \) b, V. b
//高度
2 R% q0 ^7 w: x9 E) O- e' }! Avar marqueeheight=25. C! ]6 n' a, G; v0 q8 F6 |9 X- k
//速度(1-10) C; M# K% z. C
var marqueespeed=32 ~* Y" r& ^: ~
//背景颜色
) r& \2 e+ A' v4 A6 qvar marqueebgcolor="#FFFFFF"
, [( i }5 _( \1 g//是否能暂停 (0=no. 1=yes)?( {' d* i8 |0 w" }! y; M
var pauseit=1) @8 c. |; {5 Y$ [/ [6 I
' W6 y4 @: b' k7 W//修改显示内容# a# a: ]" b7 x$ p, G' n" u" L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, Z3 h0 f @# x6 U8 d5 Q/ V9 C
* h( ]; u& s+ {* ]3 m& x, ?
0 S! r8 }# n2 d: [3 \. l////下面不需改变////////////
2 F9 d! ?7 _% N2 q: Y2 p9 \4 N# n( C2 K# x5 x* `* {
var copyspeed=marqueespeed" T# ?7 v8 z' {% M
var pausespeed=(pauseit==0)? copyspeed: 0/ [0 H9 {. f: a$ \3 T; H
var iedom=document.all||document.getElementById( Z1 ~3 b4 }+ f2 Q
if (iedom)* C! K# r5 J4 j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 I( [0 ?( q! Y( v7 V
var actualwidth=''
- B. o& M1 f5 N- Wvar cross_marquee, ns_marquee
# d5 y: b9 J, R9 f! B7 A6 |! S- Z3 k
function populate(){
0 n) b: \' J5 N0 G- l: r! d* iif (iedom){0 ]+ J8 X+ V5 p3 \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ @# n6 j c" K' v3 y Ncross_marquee.style.left=marqueewidth+8
+ ^+ J+ d! Z; K" [3 M( Z8 o7 fcross_marquee.innerHTML=marqueecontent
: b6 G/ y9 K! K% vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% t! H$ k1 c: j# g8 k6 V- {}
) i& K& w% |/ Celse if (document.layers){, F7 L. K% t! \2 Q6 o* j2 o; N
ns_marquee=document.ns_marquee.document.ns_marquee2+ A9 M! K3 P% p* E/ F, v. N+ u
ns_marquee.left=marqueewidth+83 r& |# i7 h, x, O; Q; { ^, x
ns_marquee.document.write(marqueecontent)
6 @5 ?6 a0 }8 e4 x' N1 d- Ens_marquee.document.close()
& R! f# }' m- G- ^actualwidth=ns_marquee.document.width
& q4 s: H# G8 k( J}! h+ x4 R; {/ ^6 |6 @
lefttime=setInterval("scrollmarquee()",20)
0 c6 l* G" f( v3 z0 m}3 `9 T+ q1 {8 f; c! w; Z
window.onload=populate3 W! R7 N1 f% S% W' D
3 |* x. h9 G, Y/ z
function scrollmarquee(){% F2 ?' S+ Y: n1 E# v3 k0 e/ T
if (iedom){; [* H. l1 w% a+ }
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! s' v) r' X$ i- r3 y. Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" j! _- q6 L+ c# s, n
else, m) v) D* M8 m- j
cross_marquee.style.left=marqueewidth+8: ~% v: E- h$ t& D4 A
) E. ^% W9 B, h0 |6 R
}% o* J, C8 K' N- x
else if (document.layers){6 v. _/ @- s5 l) b
if (ns_marquee.left>(actualwidth*(-1)+8))
* o* g4 |1 P+ d+ Q' }ns_marquee.left-=copyspeed
. N( ]& }2 ^6 [, r- Uelse
+ x( V$ g% K+ D1 R) Ens_marquee.left=marqueewidth+8: p, ~9 w7 \9 t/ K' |, ]
}% d7 Q) r6 F7 |# e
}
6 N0 g3 h) p" r
* T- r9 c: J& W( H4 F/ Kif (iedom||document.layers){+ m0 @- K0 u2 L' I
with (document){
% K5 B; c" S+ L8 K, C' kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); v0 } n1 s; |' z7 X6 h
if (iedom){$ H/ `: |( ?7 U9 w0 V, d& I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& j- I- w! }4 l& E: b ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) Y! J0 x/ ?( T9 {# e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ C0 @7 @( f" f; b& q' Awrite('</div>'). D0 Q" b+ B. h2 r' s
}% r% H9 U6 w- l, r3 z- m% P
else if (document.layers){1 {, \8 H. D& P# K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 ]3 x; l( ~: I4 u9 `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ p9 e) }) ]0 K3 B
write('</ilayer>')" [# |' @3 z7 Z& M7 ~/ e
}
5 E, j! N8 H8 ]document.write('</td></table>'), d; Z$ b4 ?- A: S! _$ _" z( q: ?
}# j# L/ L/ R0 R; s' C' [$ g
}
7 T3 d, V3 T' u h! w. O1 n</script> |
|