获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
  ~/ G/ x! b- G% t  nvar marqueewidth=300- S+ ?( Q& j2 r* j( {: P
//高度8 K5 U( j6 T# c, u4 Q, U* j
var marqueeheight=25
/ O9 J+ V+ h( S6 f; Y//速度(1-10). Y* y  I  o! t! L( E% Y( `
var marqueespeed=3
$ u3 l6 U% u$ i* m+ `7 R//背景颜色$ D: q2 \+ M% R* t3 R
var marqueebgcolor="#FFFFFF"
+ e* U! `8 C: X0 y; C( B. |//是否能暂停 (0=no. 1=yes)?
! S7 u( j' W7 H$ E0 X$ q& z: `var pauseit=16 A) P& N2 y4 w: y

) v! Z- M6 {8 o6 l& i//修改显示内容
& c6 v( X' O5 u+ R1 v4 Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ v0 E, X; `8 t, i1 J# @* e
6 `; R. l; l/ A# q

  Q3 T7 N/ R. ~5 D5 W////下面不需改变////////////9 D4 ?' G- s" R6 O

( w6 G2 [/ B# b0 Q6 g% I) Qvar copyspeed=marqueespeed
& }. v8 _. u+ q7 O5 a1 ^9 Tvar pausespeed=(pauseit==0)? copyspeed: 0
+ U/ v+ J" K1 k7 `0 g  @) d' _$ kvar iedom=document.all||document.getElementById5 n- V1 c3 s: N5 Y+ b
if (iedom)
' U' Z3 X' \6 U/ [$ L! i: pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 w9 O  }4 U7 ?' M' H3 |3 dvar actualwidth=''
8 u( h3 u! j9 ?4 dvar cross_marquee, ns_marquee' C% ^# `4 l7 X5 V9 f
! M& u+ }, l" T1 w0 c' I
function populate(){4 O/ P( A1 I5 p: d
if (iedom){
0 s8 U1 ?! D8 |" {4 a! K3 Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 ^; G$ ]* O9 k1 v4 d& e' ucross_marquee.style.left=marqueewidth+8; a- N0 u6 C( ]2 u
cross_marquee.innerHTML=marqueecontent
* W+ }8 T, T  G5 i9 Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# L% A7 C. ?; ]3 s
}
2 `( M2 e! t7 m1 T$ {' j& x& a, Nelse if (document.layers){
9 Z6 C/ K7 \3 B( h# r5 M3 M/ C; A1 H/ cns_marquee=document.ns_marquee.document.ns_marquee2
" G; B' f$ ?) e7 o' d- cns_marquee.left=marqueewidth+81 l2 l3 h: |3 K; V  [( P
ns_marquee.document.write(marqueecontent). n0 ~" S/ I8 Y, e8 Q. F; m
ns_marquee.document.close()4 R, b7 m$ F. Y" D, e$ q5 I
actualwidth=ns_marquee.document.width
' y* R- a. |  m; I3 m' J$ r* w}# D/ m( W* ^/ P# J& ?6 J" B
lefttime=setInterval("scrollmarquee()",20)1 e: K8 }$ b; P5 V
}
7 o/ M3 ^+ z: vwindow.onload=populate
4 Y8 G2 c1 C) c( f; ]6 D' _& M* b7 U0 c! Y: |6 H: A, n
function scrollmarquee(){  l8 Z' m* ~  W! A2 M
if (iedom){- H4 d) i8 }/ X, |" H7 J1 i  U3 r! z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 d7 p( c% I! p/ ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 u; ?( ]7 J, ~% `5 ]( u7 z
else
4 }8 E! l; a! U9 G  P3 bcross_marquee.style.left=marqueewidth+8
3 I" B# N2 y+ F, V4 B9 C$ C6 J# Y3 \! f
}
/ g! |4 j: G( `3 z& Velse if (document.layers){
4 Q  ~" |9 a4 X9 R1 n  Y9 Tif (ns_marquee.left>(actualwidth*(-1)+8))
2 Y5 j) T0 H' p' w5 r3 M- Sns_marquee.left-=copyspeed) b; n1 M  F( W7 U7 T2 o
else( f+ k0 Z6 h7 d
ns_marquee.left=marqueewidth+88 f7 r% o$ a4 f, [2 `! Z7 i( u
}
6 l, `! I5 C3 B; U}9 z0 R- z  x3 \! A5 [
- N. L# D& b: a+ T- C
if (iedom||document.layers){
% I! @- N4 n* R- L0 t! h! Hwith (document){
/ A1 p' N4 u+ \+ ?( l% C9 v* k" @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: C- K: E2 a9 @5 Bif (iedom){
& k9 h6 T5 |* L* A9 x. wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( ~  U/ |) C/ u" A" n7 M" O8 k
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  u6 |/ d7 j7 b; L' G: owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 B+ Y3 _5 \* y) b. u) `write('</div>')4 G5 O% c7 H$ I& C, |/ D1 B
}
3 ^  R- u9 e& S, E$ j4 l: welse if (document.layers){0 R: x# `/ h5 N' b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' s; s4 }% g4 A. D/ f$ b2 ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 Y& A" s2 `* M
write('</ilayer>')) \) P  R2 p* O5 _. J$ V! f# B# D
}* h% [1 {. z0 \% O0 m  O
document.write('</td></table>')
( a$ H) Q8 s1 |! h}
# t7 {2 f: R/ k$ Y# K4 N' t1 W}
" d* \" ~8 f" F5 z  r' O</script>

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