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

|
网页之跑马灯文字特效
//修改宽度
+ a. R9 c z5 Y7 A6 C Y- rvar marqueewidth=3002 X( }2 l- m+ Z
//高度( M' p8 C" S8 j- [/ T
var marqueeheight=25
! A- P! U6 L) T! g( S5 i//速度(1-10)2 H* L O/ {2 K! j
var marqueespeed=35 l" Z0 p/ A3 T& j0 H
//背景颜色
# r4 s/ V5 T+ x& E0 u5 uvar marqueebgcolor="#FFFFFF"* X. o' X6 N8 a- K# G2 c
//是否能暂停 (0=no. 1=yes)?7 e$ A0 G9 E! d7 g( ^: ?9 s* I0 _) Z
var pauseit=16 ?4 p. X8 a0 z8 ^& `
V. a+ N- d5 E( g//修改显示内容: G3 W* s' l$ Q$ ]4 ~( H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 u$ K) H! S7 {+ M: W
- U# s" c m* T5 a L9 D
y# ]/ L, W3 C! `# U7 |////下面不需改变////////////
+ {3 W* D( D& c& [( j8 f T0 X
5 L. u7 w, ]3 S( ^* u6 t9 ?var copyspeed=marqueespeed) A6 J1 V/ g9 V- u
var pausespeed=(pauseit==0)? copyspeed: 0
6 I& ]3 q1 {. R1 j8 G& evar iedom=document.all||document.getElementById
9 x& B& O) q, |if (iedom)
; Q9 B, V8 x! P" Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& V# v* E @8 m* b' S$ K( ivar actualwidth='' m" E1 r0 ]; L
var cross_marquee, ns_marquee
& }" T; q$ y: `- f/ p. Q6 V1 P6 Z: ^9 v5 s$ i
function populate(){- k( d. S7 K6 D8 P
if (iedom){' l2 {! c7 o' q# y+ w1 Z `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: }3 _9 S( z0 ]: d0 scross_marquee.style.left=marqueewidth+8* {7 \9 F; l: J6 b1 L% }8 \
cross_marquee.innerHTML=marqueecontent- Y) W; t6 K& i [0 U j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* [4 U) g1 u/ {" M
}: e. o2 {7 O7 U# N0 g2 L
else if (document.layers){" ]: L5 N7 s+ m
ns_marquee=document.ns_marquee.document.ns_marquee2
6 q- J+ @( Y: N1 h' H6 X/ g( vns_marquee.left=marqueewidth+8
( P w' F: i+ h [! f* y1 x* dns_marquee.document.write(marqueecontent)3 ^6 f+ o* j) n' e! H$ s8 g
ns_marquee.document.close()0 i& Y* X& N. J X, a: R# Z
actualwidth=ns_marquee.document.width
9 |+ k6 r* X; @ K% _}
6 x% g7 J, h/ dlefttime=setInterval("scrollmarquee()",20)
. l" Q) K, a/ A}
x3 I& t% ?% w2 F$ ewindow.onload=populate# ?. p5 V" T* k6 O
6 z# m$ J& C+ @/ J# T' @) A
function scrollmarquee(){
% [! c, x% ~3 ^( z% H' U/ o) _$ Pif (iedom){
# @1 o7 l# ]# w+ Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 u, U% x+ ^5 ~6 L4 T; I# c! across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 e( H' o& V5 M( Belse
* m& s. J$ D. v3 e" s, Vcross_marquee.style.left=marqueewidth+8
' b8 j7 n6 j5 H/ v6 u- V* S* u4 o& ~' e/ j
}4 C6 u, L6 O. L& G2 S
else if (document.layers){# l0 D7 q" i# |6 D+ K" M! Z& p, V
if (ns_marquee.left>(actualwidth*(-1)+8))8 `3 @8 C) o7 l6 J
ns_marquee.left-=copyspeed- p1 j; k; T0 z, C
else( X. a! Y) ^. G9 `# p: l
ns_marquee.left=marqueewidth+83 b' k. o: v; d; S( l: X: \
}
% }% c) _1 V& I6 o# Z}" V0 d% v6 ]: `5 `% X2 d. d5 [
, x6 v+ Z+ |4 z0 ?2 u5 k- a# Aif (iedom||document.layers){7 r; B" {& z$ w0 ~5 Z6 A
with (document){
* K8 |9 p3 t5 j! K1 Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 k+ @) F1 W. b; j0 Cif (iedom){ t# y3 `# @9 ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
B( X& I s. ]$ T N. a* ~. Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' o5 g, t. } o( x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ H6 s4 [& X, c6 }1 e$ g
write('</div>')* ^2 g3 y8 @! `: k, f# T
}" I3 o" G+ y% p5 C
else if (document.layers){! r9 d0 U, A# C; ]* Z, ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ j8 I. y+ }4 e; ]; A8 d( \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, Q4 Q9 J% m- ?- jwrite('</ilayer>')/ A3 U/ N; v) V( E
}
7 z5 F p/ N9 K5 O3 Fdocument.write('</td></table>')4 r6 u6 Z$ @; A% n8 o5 X
}1 R% |4 T' e7 W+ g
}; Q5 e, H( ]2 j! j7 `+ B
</script> |
|