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

|
网页之跑马灯文字特效
//修改宽度- ?+ n2 E3 _/ Z" Q3 a/ n& U
var marqueewidth=300% {/ Y A- M* K: p0 T
//高度, p! u7 e: T; ?9 q" ^
var marqueeheight=25
- d& F p4 u ]; T% f/ B//速度(1-10)
Z, e1 Y, t, Q: s% T+ v- S4 Vvar marqueespeed=3
$ q* K; i9 ]7 G6 s! h. N//背景颜色
, M4 @* r: X6 l- n1 }var marqueebgcolor="#FFFFFF"4 Z; x4 u+ i; Q5 @( S& ?* T
//是否能暂停 (0=no. 1=yes)?7 [( W" u8 X, G% [4 C2 U ]
var pauseit=1
8 O* `# ~) g% \. ~5 X
7 t+ w$ {# Z; T! Q4 |2 R& f I//修改显示内容+ b) P; x7 `, e1 C0 f0 J0 H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* M; ]7 t; o! i" V! ?
/ e, `: E# b1 K6 V b: E* N9 \! L9 `: P7 ]% r# u% k
////下面不需改变////////////
4 R2 l' m0 \5 S+ t( N1 j: [( L% l" N3 p& n
var copyspeed=marqueespeed, t( U# N7 ?: X' t$ w! v
var pausespeed=(pauseit==0)? copyspeed: 0
2 E8 W+ e& B, Qvar iedom=document.all||document.getElementById0 D. u) x8 M4 E& h7 J8 p9 s
if (iedom)5 z& f6 C/ e0 I! J3 m8 |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. D0 V! I" f! E, s! r5 fvar actualwidth=''
1 o! a/ V4 K# b$ |var cross_marquee, ns_marquee
$ {, C' J9 @0 `# y: }
9 ?" ~7 X( `4 W& I; z1 X: Wfunction populate(){
3 @5 i# o$ s I$ X- w* }0 @if (iedom){
4 ~' g! B' @6 F% {% o4 M! Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 ~/ T$ z% z. K( D7 {) m7 ~( Dcross_marquee.style.left=marqueewidth+8 b `9 _2 R7 }
cross_marquee.innerHTML=marqueecontent. O) H* [* ?/ h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 ^2 H7 I5 P) W}
) W: H$ z) P5 u+ C5 V) ^8 P( melse if (document.layers){
& i+ j8 V5 Y: A$ u: s3 wns_marquee=document.ns_marquee.document.ns_marquee27 [- W( |) s/ ]$ P- R
ns_marquee.left=marqueewidth+8
( V0 d( B# g$ Lns_marquee.document.write(marqueecontent)
0 s" ~+ M1 n, a; dns_marquee.document.close()% |7 C% V% k+ k" ?, ?( x$ p
actualwidth=ns_marquee.document.width
2 L6 V% _7 A: v# i4 n" C. z. v8 G}
5 a8 O$ |& K- b! Jlefttime=setInterval("scrollmarquee()",20)
# C, }: h* I! w6 M# F! o8 K- s8 G8 N}* c- w1 ~3 D% d1 z) E, X# X: P7 ~
window.onload=populate
) r: d# ]# z4 w9 E
, r% b- |4 o' Q1 s& Tfunction scrollmarquee(){
) Q& l/ Y% W/ O0 ?) sif (iedom){+ h# x4 A% @0 @- |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: V8 W) v( {# N, Z2 c f* V! K y# |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( U4 V( P8 T; d
else
: h! W5 D( N8 Ycross_marquee.style.left=marqueewidth+8( C4 c, I: l6 N5 b2 d. Z! o
& U# D% U q5 u
}4 V: R' T4 |; W, h
else if (document.layers){
# _- T% G' c4 v: x- S' fif (ns_marquee.left>(actualwidth*(-1)+8))8 i2 A" P! V8 E4 n% P# q+ B% y
ns_marquee.left-=copyspeed$ \6 c. o' Z! L
else
7 Q# j& u$ w* i. \. s' ?ns_marquee.left=marqueewidth+80 _* w8 B7 }" t4 W+ R. y+ s
}
% r' t8 y! Y6 q! M" N) [}
# d0 `$ y0 Q1 _7 p. d7 t% e0 A( g" P4 ?7 A5 ]* G& B
if (iedom||document.layers){
0 l# U7 y, n2 }2 V; O. }/ ewith (document){9 k. z: b# S0 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; q# ?# I) i5 x+ t8 x5 G% ~$ vif (iedom){4 U3 ^' i7 t0 G% s0 s" N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" o1 \; r" L T+ v9 [: B) Q$ i; ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 e( r) R* |+ C- X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 x9 F! w* u- ?) ]. g& ~" \ t% a
write('</div>')( U0 p" ^' B8 e
}
% i" _6 f$ m5 Welse if (document.layers){' P; W5 [: p; I( \+ Z/ `1 P& ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 a+ W* O- c7 _2 k6 `* Rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, q* d" ?7 q. x: L* | D% ~write('</ilayer>'): ^% \1 M* F) M/ O
}
# @: r6 \: Z9 \2 ~/ A; ^" P6 v* wdocument.write('</td></table>')" \. Y7 n' T0 O! U9 M5 T! S v5 A% @
}
- n6 H5 r. n$ J- n' [: v}
$ n1 c+ s3 j8 Q. }3 S</script> |
|