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

|
网页之跑马灯文字特效
//修改宽度0 }: J7 F1 u# P: _0 E0 f
var marqueewidth=300
9 y1 O4 W: S4 {5 e% D) D//高度4 }& Q$ [6 M T$ k* E4 F
var marqueeheight=25
- k) G- }. U5 z z, ~//速度(1-10)
. n- H$ q* z1 q8 a% Ovar marqueespeed=3( J9 x. S- R W
//背景颜色
$ T3 x$ k# {: j! q' a- r* Avar marqueebgcolor="#FFFFFF"6 ]# H4 v7 B3 v
//是否能暂停 (0=no. 1=yes)?
+ ]6 Q6 t$ O9 D7 l- _1 c" n/ _var pauseit=1, d1 x F8 a+ A3 v- j# G
! j" a9 W- L% g. k
//修改显示内容
( s- q T9 i b6 q# N- avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ a* E S+ t+ L& l l ~
9 m$ ~; \- ~4 j. |/ D; X6 T6 w- k# s
; X( i- R: q2 w5 H# v7 }- P2 W, C n////下面不需改变////////////
! o2 X* i% ~! ]/ T& v( W4 O
# u" e. C8 {$ r" V9 jvar copyspeed=marqueespeed
. r4 g4 Y% f1 I) t- Q* X- d6 {var pausespeed=(pauseit==0)? copyspeed: 0
6 ~& Q+ Q& c& V) c* J. x/ U7 Mvar iedom=document.all||document.getElementById
6 n# F2 f7 Y, z$ |, d# mif (iedom)
& O5 S: i2 P. i, Udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 \& j2 T, s9 T' u H5 d! ?) w( Q7 avar actualwidth=''
, H! W0 j3 N/ |" jvar cross_marquee, ns_marquee
7 I- c! B2 g3 ^' [* j
4 c9 y L5 w9 h: ^1 J7 P; g N7 _function populate(){
4 R0 x6 X% U0 V1 v, s5 P0 Kif (iedom){ D. E6 q" w7 h2 U, t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, S" W5 K1 w, A, U
cross_marquee.style.left=marqueewidth+8
' H; K9 U+ l$ rcross_marquee.innerHTML=marqueecontent
4 e5 D% k8 J4 F8 v* I8 zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ S" x/ @9 a) K4 s4 _: P* F
}
1 h2 [9 J; @, V! Eelse if (document.layers){
' v" o$ J0 J( bns_marquee=document.ns_marquee.document.ns_marquee24 q4 f5 l- q8 x+ W
ns_marquee.left=marqueewidth+8
/ l3 J1 g1 g5 W# kns_marquee.document.write(marqueecontent)
/ {' s A% U7 a$ |8 g4 X1 _ns_marquee.document.close()) i9 _% M3 {! a1 F5 u9 W
actualwidth=ns_marquee.document.width: f) [! \" Y* R, {1 H
}
, t6 S, ~( @* \, n: d( {lefttime=setInterval("scrollmarquee()",20)
% p8 ~& V" i5 O2 W6 H}" b( {$ \9 x d% {+ w& A: x1 E
window.onload=populate
# P' {) y4 a" H, |# G+ x; ^; Z2 \# S/ s) _2 @
function scrollmarquee(){
4 L1 X6 R# [6 |) T. Cif (iedom){
1 z7 g+ ]" i7 r( d! ?, gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 G2 ]' k7 Z, f; C, H2 e# a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% S, ^% C) ~# {8 [ K2 o0 P
else/ q, G# M( M& h* ], l, ]
cross_marquee.style.left=marqueewidth+8
+ l4 B9 \1 [% I& w$ q& d& y& d. d1 ^) L$ @, E" J
}$ T+ O8 x4 @. Q- i c' ~& ~- ]
else if (document.layers){8 C* E& r5 `' J$ Z% O. l
if (ns_marquee.left>(actualwidth*(-1)+8)) i3 y) J6 V- M2 t
ns_marquee.left-=copyspeed
+ D! B. @- t' Telse2 O* ?8 X. R: x( ]
ns_marquee.left=marqueewidth+8
: \; U/ f5 O% C}! y! L8 f9 U3 l9 S% |9 @4 ^
}1 J/ x2 r `& \2 e: {
! q0 |8 p* x0 q& `1 g
if (iedom||document.layers){
5 j5 |6 E9 F9 i, y9 J4 Zwith (document){; A7 Z6 h. s# w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( X+ l! {2 b; f Kif (iedom){
( k; R' R& P, a twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) p: V, M& W1 X) |- _
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, }8 `9 v% z2 R* x/ bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 d3 `0 W% H d! hwrite('</div>')3 ?* t+ L9 M B: n' s! M
}/ U) q$ l8 ^6 {. V! j$ L) i4 j
else if (document.layers){/ x+ T6 K2 ]0 ^. \( e7 z- {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 F; s+ h3 P. s- H5 p% p8 z+ Z" f' `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 F" W: c: h3 u1 _+ A# }$ @2 w
write('</ilayer>')
2 s( H5 a0 Y! l7 ~4 {6 n}
( v" Q. |) j" G# @. S* O. L7 cdocument.write('</td></table>')% J8 Y7 u. ^# U; ?% m7 `# L
}
5 u+ R% D9 D. K9 \}( v z8 V; k- V3 e
</script> |
|