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

|
网页之跑马灯文字特效
//修改宽度( r. {9 u, T# f' [9 w4 t
var marqueewidth=3002 W. |9 O" F( F" W4 j0 m# W
//高度
% y( h' F. j3 P, D9 i x8 }var marqueeheight=250 Z2 p% r2 f; U5 w
//速度(1-10)% A1 L$ n O" U, ~1 a
var marqueespeed=3! B3 I n( j9 b" r6 f
//背景颜色
# W- P! k1 J; b( ^var marqueebgcolor="#FFFFFF"
G- o( L5 _, B4 x% K# ~//是否能暂停 (0=no. 1=yes)?
; G0 z+ \ k# Q, evar pauseit=1
& L6 ?9 g2 u) K/ T9 U( T% [9 c! G6 Q
//修改显示内容. C5 _7 G _9 T, t# L: j* H* G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) |5 }/ v; D0 q* \) z! D, z: X/ v9 _) O
# F' A1 d1 r" d+ y
////下面不需改变////////////% B0 s/ r; T- Q1 E2 j/ U6 Q
# n) |. q0 _+ a2 Ivar copyspeed=marqueespeed
1 N5 \0 @0 ~9 q0 ~& z" f3 Evar pausespeed=(pauseit==0)? copyspeed: 0
1 M/ ]5 f4 ?7 D. C3 v* Wvar iedom=document.all||document.getElementById" U. a2 E" f+ ^# ?! p) ~6 l. s& }4 J
if (iedom)' w1 I# y2 r1 s/ g# ~/ o/ W, g6 I: a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
q& a: \ }( o4 ]$ `+ Cvar actualwidth=''
) C5 C" O* A0 L- r G/ _5 h9 m: v0 Ovar cross_marquee, ns_marquee
; I! @, j+ ]- n8 d; c
6 {7 h! B" K J/ \! }function populate(){, e% o! H1 ?. O8 S6 c; F
if (iedom){! p G# w: A( l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 V4 g; H4 y" Y+ N( bcross_marquee.style.left=marqueewidth+89 V ^3 E4 |# v/ _. Y' M
cross_marquee.innerHTML=marqueecontent+ s. O% Z- g8 _5 v3 k' ^- ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( a& j' F" o& ?}
0 s5 z- C' a" \7 }else if (document.layers){& ]- n5 a" C% d+ l
ns_marquee=document.ns_marquee.document.ns_marquee2, n! x `0 r( {1 [ X
ns_marquee.left=marqueewidth+82 ^) B/ x3 b% m8 S/ O' D
ns_marquee.document.write(marqueecontent)6 W6 u8 [/ ^9 j/ n+ g0 @( s) w1 G
ns_marquee.document.close()
; x$ I! l! _- o( K# N1 pactualwidth=ns_marquee.document.width9 Y: [, Q; C; [# }) N! Y* y0 @
}
3 }( i! V) R4 T6 A" K! ?$ e* ^4 Dlefttime=setInterval("scrollmarquee()",20)
% V D% [) [" y. b8 F8 T}* _' I# x/ B: Y4 v5 Z2 a9 {0 A. v- s) n
window.onload=populate
) I5 \0 r) _$ C+ o# U- L" ]6 d6 b. p) ~
function scrollmarquee(){" S# U: O( [, h* }
if (iedom){
) Z! O( i4 s5 }/ u, X: g7 rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 d2 A0 m! I- _8 D8 c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( X- n" [9 c+ J _0 g* s: G, zelse6 T7 a* |5 S( o) m$ o9 |
cross_marquee.style.left=marqueewidth+8+ L0 N o! [7 x# T4 W- g9 Z( }
0 d5 A# K+ g& v; J% c* [* K( m( f+ d
}1 K D* @: F+ B- @
else if (document.layers){: a; M2 T: J* w6 w+ O+ B" Z% n
if (ns_marquee.left>(actualwidth*(-1)+8)) f/ z& U2 q$ O. T$ J" `5 r6 x' i
ns_marquee.left-=copyspeed9 @; z4 T1 Z6 n& Z1 g0 g$ \3 x
else
9 [; e' J' d% o8 j& H Fns_marquee.left=marqueewidth+8
4 B0 E$ [, H! k% y1 ?}- q' K9 s! W0 H1 ^+ E9 ]
}, F1 _, Q# u l
& d) C/ W& b/ Q: v, z( r9 G
if (iedom||document.layers){, L: c' M6 {# h3 x% X
with (document){
1 x, \5 K5 S$ U4 _# ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 r8 C1 h2 w0 J0 zif (iedom){! x0 S+ ^+ u3 w6 B0 e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% a% m( f0 j6 ?- C- b( n' rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 G2 w" f: x- [& a1 S( m: Iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). V+ c4 ^+ k ?+ p2 p. [
write('</div>')# x$ K" i$ M/ J+ h0 |" {1 Q/ J) _
}; h, m- P) M! c A" [8 O
else if (document.layers){
- `. i9 b% E# S3 T$ Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* I' H; S, h; d# uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" ^, d0 U' t9 w7 E0 R% F4 R
write('</ilayer>')
; E- U" v* |, l7 w6 L}
, a& F% a. [7 ?4 Xdocument.write('</td></table>')/ u+ j- R! `) W1 I. @. q' x
}- K' e, q! s+ D" u2 d+ p; R1 X
}# [* h: j) _. u' {6 }; z( j5 a
</script> |
|