返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ \$ w: J" v! P# o6 o" b* g
var marqueewidth=3009 _: J, V+ ^. Q
//高度5 a$ L* u6 u: H, y. j6 U
var marqueeheight=25  d( L8 _$ }& W/ Q7 m
//速度(1-10)
5 l9 F' p+ }6 O6 h. ~; Rvar marqueespeed=3: f0 X( _0 F% [
//背景颜色6 A* W+ f8 _- Z5 P& h
var marqueebgcolor="#FFFFFF"2 J8 W, t: D% A+ W; ~% s% h9 V
//是否能暂停 (0=no. 1=yes)?8 V) w- w8 `, {9 o
var pauseit=1
( P) M. H9 T9 B( b% n
: u  @; [/ ^& @. E  j# X) |7 t//修改显示内容9 H+ w( W. g% b4 T
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': e! M6 ~, P# a' _. i
- ~/ x3 r- n4 {+ e1 O/ F
! f% p8 t3 b" K/ I% c; C2 I
////下面不需改变////////////& E0 J/ A8 N! _

5 u5 T% H6 Z" z# x5 w1 ^% ~var copyspeed=marqueespeed
% ^6 R- ?: O; C7 c- p) Wvar pausespeed=(pauseit==0)? copyspeed: 0% R# d& V; R$ j) E0 @5 G6 I. \
var iedom=document.all||document.getElementById+ G: P9 ?# d& l# |
if (iedom)
# ?0 E- D5 a3 T  I2 Q7 F- @2 _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; e+ m/ k- _, s- _. i7 hvar actualwidth=''
+ x: W( P1 E" u/ Q, E& J7 |var cross_marquee, ns_marquee
' t8 M$ f2 l5 ]5 ?. M0 D
! p' o% k# e+ Ufunction populate(){) s$ {, T& P/ J/ l6 F8 C; k7 Z7 @
if (iedom){
  p0 {4 s1 P$ I+ Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, d8 [8 x! A" j( {3 g
cross_marquee.style.left=marqueewidth+8
* a9 F- l; N0 T" y- d8 ^' icross_marquee.innerHTML=marqueecontent
, s; H' h  N" T' aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 u4 [, K& E, f4 x0 {2 v  H6 l4 m}
2 M, {0 n& b/ y9 s& u! `else if (document.layers){% H8 ]9 M, N0 K
ns_marquee=document.ns_marquee.document.ns_marquee2- `' t, i8 W: b, j1 |! i. g
ns_marquee.left=marqueewidth+8' J8 P# ^2 t8 j1 ^* l
ns_marquee.document.write(marqueecontent)
5 Y  T. \& v9 \9 T+ e' R; Nns_marquee.document.close()0 Q$ L/ P  T. C* [) K
actualwidth=ns_marquee.document.width. n0 P7 z" S/ ~6 B9 @
}
, P/ I/ F6 F- }" t' j/ b  ?lefttime=setInterval("scrollmarquee()",20)6 j4 H0 i1 N- q/ r) y
}
; f( ~2 X' \& ^5 L. Rwindow.onload=populate5 b6 P  C# e+ Z

* _8 `# m; C! E1 Nfunction scrollmarquee(){6 m  O5 C# ?" b$ i
if (iedom){
' [) l2 u; w, R) _. m% @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ H% C: B  E( H# Y! m6 e
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 l4 K1 e# B" J1 X5 s  g* U" y# O% ?else; W1 C3 B; W2 T" U' D+ d0 d5 C
cross_marquee.style.left=marqueewidth+88 C/ F! k3 E& @( l

- k7 A1 X. O. X+ ]}) K- R8 t9 }% I( G) H$ O: n( D  i
else if (document.layers){
7 z- f% B! u3 s* P* d: L5 yif (ns_marquee.left>(actualwidth*(-1)+8))
! ~0 i" t, N* X9 n& E1 K! bns_marquee.left-=copyspeed
9 s! q8 ]0 D: L; Jelse
) D: ]6 b6 h8 i, K" N6 P3 R* qns_marquee.left=marqueewidth+8
: B  E0 a. `8 M: }' k}: K  f% Z1 X  b- f
}
9 r! F; m4 r  y8 r7 ~5 E0 Y
( i. c# u. i! T! S' F7 Q+ aif (iedom||document.layers){
, d7 T$ W8 G0 S) Jwith (document){- h/ Q7 O, T0 n0 c: \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% \2 q; |: h1 j7 y5 H# ?8 Iif (iedom){! G" }  X  }2 f  L8 @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 e3 Y* q2 t1 n7 @5 u- \5 Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ O' m2 n- b/ B% |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( P2 x  r& _6 Uwrite('</div>')7 P/ W; p2 I! e- ?
}
. A/ l$ J+ N9 Helse if (document.layers){& G8 y, l" X/ b8 i4 I3 H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- b7 O8 J3 H. n8 Q& ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% n( R/ d+ B4 r! ^, x2 }3 Q) z
write('</ilayer>')$ z7 @! ?* e! m9 M& P+ L. l' ^
}! d) ~1 h4 {1 w0 V
document.write('</td></table>')$ a) i9 C. i- @0 g0 t+ u
}
& H  K9 d# J8 t$ I) T+ x}
) H! b$ e+ _+ T$ @+ N  M</script>

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