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

|
网页之跑马灯文字特效
//修改宽度# @' S( w1 r4 k% m- f7 H
var marqueewidth=300
3 ^+ S7 f5 g) M//高度' |1 i3 z) X# a, \
var marqueeheight=25
% e6 I8 J! q5 }* Y) T//速度(1-10)
# ]/ e+ t0 I( T# g3 r+ Z5 h5 W) Vvar marqueespeed=3* W8 E. f; k# @' @
//背景颜色$ H8 f$ W- }. e4 H3 F) S. B
var marqueebgcolor="#FFFFFF"
; v9 S' Q. j% ~, z//是否能暂停 (0=no. 1=yes)?
/ E" H D w+ k* L3 l0 Dvar pauseit=1
; `2 p8 T- u5 A3 P* ]! Q. l) Z: D
//修改显示内容6 L, S) v/ T/ d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ A# g# z$ G& K) M" }
' Z. D% t$ h% M7 h$ U: r; T
2 Q: F- D u6 o: f, B8 R* k& Q////下面不需改变////////////
1 a V3 E. W0 n$ ?
- [- r' T# t- V" i( ivar copyspeed=marqueespeed
7 p$ z* J a8 fvar pausespeed=(pauseit==0)? copyspeed: 0
( D1 e" t7 F+ J2 u7 M# ~' \var iedom=document.all||document.getElementById
3 h1 T$ K7 H$ [$ r( x1 r1 h4 hif (iedom)* I9 i; \0 U, |3 |3 g1 b& D: `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 k% \* o- m! a( t. U6 [% jvar actualwidth=''
- `$ K/ f$ ~2 qvar cross_marquee, ns_marquee
+ d- k& H n+ x% q
8 Y w. ]( f$ h! A/ j3 l/ T; b C! R3 Ofunction populate(){. b9 D5 |) C' M' N$ h+ R+ r
if (iedom){
$ c. ]/ M% R9 c- r6 d* ]3 u3 d7 Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ @& y! V" I, r3 ?3 g
cross_marquee.style.left=marqueewidth+8
4 S: y7 m$ E# P8 S: fcross_marquee.innerHTML=marqueecontent
& u# h& s) J" ^ O2 _; [( O8 }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 X* W0 O# s' D( T4 G2 L
}, [" U) j5 ^ C; P/ w/ \" I
else if (document.layers){
( H) M) B1 I6 R1 f+ J+ B% U, T% sns_marquee=document.ns_marquee.document.ns_marquee2' N9 ~" V: @$ Q! ?+ B' U* v
ns_marquee.left=marqueewidth+8) C: v+ O- Q7 O6 C4 Y' O
ns_marquee.document.write(marqueecontent)
$ a7 _, R7 o! E; s! G7 ons_marquee.document.close()8 q! a; \( F7 X7 V' {
actualwidth=ns_marquee.document.width: t: J# y: f# X5 g' m `
}
/ S2 D; @0 Z9 E Vlefttime=setInterval("scrollmarquee()",20)
1 g: g' Q# A9 B2 @0 f- v% Q}
7 m7 C9 w, t, Z$ Rwindow.onload=populate
1 }: t- o/ T8 Z& r5 O
: y0 v8 m% G* e1 ufunction scrollmarquee(){: ]6 t" F, O) l) A$ {
if (iedom){' A, P7 b/ d, o) E7 _6 K3 r9 x2 s
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: X4 p; Y/ T- h L; E/ f! Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 d% S& p6 K" t6 }else8 V6 ?4 l7 \9 w6 p9 X- x
cross_marquee.style.left=marqueewidth+8
4 E5 a4 j+ Z' r `
5 X, m/ Y7 i0 Z! J}
z& e4 h: X& ]/ H+ z+ v+ kelse if (document.layers){
- b. e4 r6 O" @: a- T7 ~if (ns_marquee.left>(actualwidth*(-1)+8))
3 `# i* ]9 G pns_marquee.left-=copyspeed
e/ K+ J7 y5 ?% l" G, k7 I' [1 pelse
( z: W' x0 Y6 v! X4 \1 b6 o- Jns_marquee.left=marqueewidth+86 c' r5 @! O8 S! N% `+ w3 j6 W4 ]( y
}2 x1 n$ B: m8 u- @
}
! n" }) m- y+ w7 z- N6 }3 a# b2 z% g3 K
if (iedom||document.layers){3 x4 O, Q7 R8 e
with (document){+ _9 l- S; t2 a8 Z2 c
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# Y& Y4 b4 R4 ? Kif (iedom){
" P8 F- g8 G, Q0 N) g* [( O% \5 Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 Z) ?) I9 x6 W( Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 W$ j, U& ]' K! p$ v0 w# E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 m: O0 L/ I4 f& e7 h, d9 j
write('</div>')( ^' |2 k/ H6 b/ A+ i
}% h! e m8 O3 f1 H1 |
else if (document.layers){
# J! Y V* U0 @9 q( Y* R, [ ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): _) `, V) f2 Y! U& [6 _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 w% E; q" [* {* _; Twrite('</ilayer>')
: o9 @! T3 N! L, X' ]6 ?}7 m8 W' j+ h3 ?" m2 Q1 A: Y6 M
document.write('</td></table>')4 T8 \6 Q7 N: x' p( @* c
}( P5 D3 B/ o4 x- H
}
( z. I" h0 m$ L8 \</script> |
|