返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" j& E4 \8 J3 T: K, S# rvar marqueewidth=300
- D) D; ]0 ^  s4 |4 j$ n' J1 P//高度
3 B7 T. b/ u; e9 I! Q7 G, U0 Bvar marqueeheight=25
0 }$ x9 j) a6 P( l. y//速度(1-10)! U3 K# e2 }. v
var marqueespeed=3& u9 \+ e- T/ U* \6 p. v5 Y
//背景颜色/ [$ R. ]# e" h. h$ T4 o  S$ v
var marqueebgcolor="#FFFFFF"
+ A9 y# {/ ~9 ?3 G//是否能暂停 (0=no. 1=yes)?% G7 H2 }  m* r( l0 E
var pauseit=1
6 l( m+ p3 ]. d
! Y# q3 E0 W, h  b& i, |//修改显示内容
3 D. O  p- h# gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- M. J1 E0 [7 h; h/ A' x9 P
" a8 K, K$ _2 r4 v# D2 f% \5 u% [4 r4 r) H5 D8 @7 O6 j
////下面不需改变////////////
8 p) ]$ C1 t) Q) z
$ q$ g7 S. u, n3 E# Pvar copyspeed=marqueespeed: t  G" Q  [. C
var pausespeed=(pauseit==0)? copyspeed: 03 U2 u" l7 P% Q! X' a
var iedom=document.all||document.getElementById
& W  U+ b) p0 O% y9 X' ?3 ~7 Dif (iedom)
1 J  N4 \% L. n9 C& Rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& K" b7 Z3 O% m. f
var actualwidth=''! a9 g4 }9 p' ~8 U5 G% t* t
var cross_marquee, ns_marquee- a2 [" C" u$ K1 r6 H* U
0 Y, ?8 f  ?: L9 Y& V
function populate(){
4 W6 H9 ^2 X) Zif (iedom){
# W6 }9 h* I0 fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( e7 t- r" Z1 H! l; b- Z
cross_marquee.style.left=marqueewidth+8
6 w" ?- |1 o- J  }( I, N$ y1 Xcross_marquee.innerHTML=marqueecontent
% b0 o) K$ v0 aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- N3 F- }- i" ?: m9 b% q
}5 L( ^! ]# h. ^, B& v5 J
else if (document.layers){* i( B3 u% K) d, n# f$ c
ns_marquee=document.ns_marquee.document.ns_marquee22 n& v9 p. G0 S/ m+ ?5 d2 S
ns_marquee.left=marqueewidth+8  V3 P' B7 O5 H
ns_marquee.document.write(marqueecontent), H$ }8 I# R# c( L9 z( T
ns_marquee.document.close()( y) G4 O5 g! g
actualwidth=ns_marquee.document.width
$ X" h5 i) j4 a! c  Z}
! U0 s* o. D, `lefttime=setInterval("scrollmarquee()",20)  E" s  o! h9 o8 w, G* K1 U
}
) e& H) q+ z$ u' m+ {9 y4 awindow.onload=populate
; Q+ s, [; Y5 B- g3 ^+ O# T. H
  m, E0 V5 N4 x- F! Dfunction scrollmarquee(){1 o) I, \. p5 m5 G/ n
if (iedom){7 u+ `3 J# V8 T9 v3 {  m
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 Q0 J' n0 l: f& [1 I$ A) tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- W: A6 S! [  x0 B
else2 }7 X5 |4 N0 r' o
cross_marquee.style.left=marqueewidth+80 c( z$ O0 W% I% o2 J2 r- w
% {0 R: w+ C9 X, n0 ^" S
}
3 m  i6 j( e; Z. N% C1 gelse if (document.layers){
( d; D) C. I. S- Xif (ns_marquee.left>(actualwidth*(-1)+8))
. R3 f4 o9 |* a" Wns_marquee.left-=copyspeed) V  M5 m+ n2 V. V3 s7 p& e# v
else. p  K8 s2 r9 m7 q4 }
ns_marquee.left=marqueewidth+8
4 L4 h3 b2 |/ e" I/ G2 F}# W" o( q9 @/ e' O! t2 X$ }. O4 M5 u
}4 {: E4 H" |3 O2 w2 S' L

# i! K- J! o( E2 T; C0 dif (iedom||document.layers){, s2 _3 t; R1 ?8 \
with (document){
3 b! h3 @0 P+ odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# @: f' i8 L/ I  e% M7 l+ Pif (iedom){
9 K; _9 p. j2 c; Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 X5 e, r/ j8 I: P$ Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 J5 ?- M* Y& o4 z; `- J  J, e5 {2 T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! B/ j3 ~! p6 b3 ^5 }3 z
write('</div>')7 k/ z# u' T- k  k6 b
}! ?& \' `2 T6 U1 x1 z
else if (document.layers){, L$ E7 m& G' w. j! `3 Y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 A) S; M$ W* [) f- ^
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 g' B3 ^4 U& Hwrite('</ilayer>')! C  R* U2 |5 ?9 o$ I
}5 H  S) t& N5 V. i% {7 w! m
document.write('</td></table>')0 x4 n, S% S: o: M. W: D3 R1 J
}( T1 o* u' s, J+ t
}
/ P4 W2 P) }; t. y+ @</script>

返回列表
【捌玖网络】已经运行: