返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ J. H! ?- n: t/ c/ S9 ]
var marqueewidth=300
# |1 r) _  u* W' q//高度6 m' H5 y, D6 K9 _6 R
var marqueeheight=25
$ t$ F1 N3 h) o, }( k* G/ [% z//速度(1-10)
# J! s* _3 K+ _. lvar marqueespeed=3
( a9 W' H) y! U2 x//背景颜色8 d- x+ K; J3 P4 D; _! ?
var marqueebgcolor="#FFFFFF"$ _1 Q% ^0 C6 Y4 v( R6 k
//是否能暂停 (0=no. 1=yes)?
  m- U& s+ ^/ ~0 [4 Wvar pauseit=1
+ r$ G9 W1 R9 X. A8 V3 V
6 x; Q9 p) O; o0 g. M' O//修改显示内容  d8 i9 ~, e  i: n1 r) v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 H: Y  ^' o% U# ~! j* a% e6 Z: o7 K! ?+ j% @# a) Z. E
1 Q5 N6 G( U1 P
////下面不需改变////////////7 o# U6 p4 a: d; h

+ y, z0 E8 s# W( j' W  @var copyspeed=marqueespeed/ m! g/ t$ F1 X
var pausespeed=(pauseit==0)? copyspeed: 0  g2 \# w0 T$ X( r, ]2 K; ]
var iedom=document.all||document.getElementById$ ?% }$ g5 @% `1 N6 Z
if (iedom)# Y. r7 x/ K* K- Y3 z  k% `- @
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 i2 a3 v* u# q- f# Y, ^8 Hvar actualwidth=''+ ~9 d0 d+ P6 {+ ^) h. r9 C1 k. z
var cross_marquee, ns_marquee$ q; k$ h* J9 ^' ~2 y$ r; ?

2 t1 O* W; O, _6 hfunction populate(){% S0 C* v6 {8 F  V' w
if (iedom){
6 s" K, t* z' V# |2 d6 q) ~6 Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 w3 d" P/ a6 R$ dcross_marquee.style.left=marqueewidth+8& n, \" A% k% {2 ~$ J; O5 z
cross_marquee.innerHTML=marqueecontent5 s. T7 ^" N9 E8 ~8 U7 i
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 |! R6 y0 v. ?1 I}
1 U+ Z: o* a; _: G/ aelse if (document.layers){8 F2 F+ l7 v2 L; L( k+ p
ns_marquee=document.ns_marquee.document.ns_marquee2, Y! w0 _$ J. f
ns_marquee.left=marqueewidth+8- W1 `9 ~$ R& G
ns_marquee.document.write(marqueecontent)
8 ]! x( [  t1 M5 M1 Qns_marquee.document.close()
, j8 @( X/ r: L: I& zactualwidth=ns_marquee.document.width
  x3 L9 S5 u" j* ~4 F+ c4 }6 N0 V}
& m. ~) L; ^- y8 I, w% dlefttime=setInterval("scrollmarquee()",20)! M2 T4 C, r  N7 [' T+ }6 f( i
}
, c2 j, O3 U/ swindow.onload=populate
3 l5 {( I9 j$ F& i  B  Z6 t# @! \' P9 W  l) k
function scrollmarquee(){
, A& ?& r9 {* Iif (iedom){
2 V6 i# p3 K8 [- F( x- x( D0 Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( k% i5 @, c' d. g4 @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) S& Q) _2 H* x6 Y8 k2 p' Yelse/ I1 t2 x! d. \. v7 p5 }* ?' h) A* s
cross_marquee.style.left=marqueewidth+8
& L/ u4 B7 ~! s, h! y/ C" g8 V1 y$ E- D  Z( Z4 o
}
) |3 |( y% T, @! g* }+ d/ Oelse if (document.layers){8 A2 J8 g! _$ R2 D. g
if (ns_marquee.left>(actualwidth*(-1)+8))& K" l& |4 s0 {1 Y% n( @  @
ns_marquee.left-=copyspeed- D* L3 V0 ?3 F& d
else
# w3 P, a6 C3 A0 s; ], p5 p8 uns_marquee.left=marqueewidth+8- ~) G6 i' x+ s* U3 m
}
6 M" u+ x! \7 l2 \1 z}
: P: l3 t) |! g$ X: d: ^/ h
# ^( C( _6 k/ L/ r9 y- A- Y0 z0 ?% Bif (iedom||document.layers){, k" k8 {* V5 w0 p
with (document){- s& E7 @* c; y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 v/ J1 S* m, Qif (iedom){' q$ o! Z  k9 W3 J& I9 ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% S7 x* L/ ^7 mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), X. S  c/ `. A  c9 s" W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" t% W( I3 t  y; Z- D
write('</div>')# Y9 c4 s6 z  Q. l) q: H5 J! S
}
* e" w& Q8 X( b7 Y/ k- celse if (document.layers){
* E/ @& B- x2 ?5 m+ lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 W4 X& Z0 B6 N) Z/ v, Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ W  j& {/ r4 y. |write('</ilayer>')
  W- n! X4 ^" J}
# c8 F4 R5 H' R. U7 [$ ]1 V* Tdocument.write('</td></table>')3 J6 B% u( @  q; T$ F& {
}, ~$ m; l% H( B0 x; j+ m4 z$ k7 g
}
1 v4 V  d$ f. w; ?- N) X1 s</script>

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