返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! G0 g  i8 e. ^3 m+ p# t- hvar marqueewidth=3001 i1 g) V4 M2 e. J2 a
//高度# a) Q7 R& {, T; @
var marqueeheight=25
+ g0 \6 S' J# J8 D3 p//速度(1-10)
- x7 n9 {2 N' M5 Qvar marqueespeed=3
' ~6 `% E. I" _% P% G3 ^//背景颜色# O6 Z: w' D8 D( L. V9 Q/ M
var marqueebgcolor="#FFFFFF"$ o+ w: L+ z. F, U7 y  m1 Q
//是否能暂停 (0=no. 1=yes)?
: r- d0 M* }+ nvar pauseit=1( f6 I. J# t. b! ^6 z: B

. L9 P' Q3 |- t  ]4 g% m: M. l//修改显示内容
" W3 `% l: D6 q. bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, e. k% }# `, [2 B9 c3 g! j, a' O" G5 I. r2 Y7 _
( j/ Z0 Q* [) J/ F- o
////下面不需改变////////////
0 p. ^! i: Y4 s: E, c, r
' F) q0 u) ^3 h- I$ |0 ?& uvar copyspeed=marqueespeed
$ L5 z  b1 h; z0 F3 ~var pausespeed=(pauseit==0)? copyspeed: 0
! `6 C' s; m1 Kvar iedom=document.all||document.getElementById! w# W' I3 P% }" p
if (iedom)- G, g' b& Y% r6 S2 |8 x- a& S, \
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ J- q% N: L' t4 R# ?  }var actualwidth=''3 b) p5 P/ R% f9 o# y% A* i$ ]5 g
var cross_marquee, ns_marquee
- a) t1 y! V* j+ c3 }3 y
" s8 Y' n1 i1 H! r( Rfunction populate(){2 p6 j' T/ C$ Z/ Z
if (iedom){2 h3 P* i; t1 E) @2 Q, U$ H3 g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  n& x$ R0 |' G
cross_marquee.style.left=marqueewidth+88 w9 t2 i7 Y# t8 G& _# a3 a
cross_marquee.innerHTML=marqueecontent
9 H8 Q# d# F5 }: Q% q7 Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" K% N8 N+ H: Y! i+ V) S8 C% P
}
7 l8 _& ^) j4 J. gelse if (document.layers){! K3 @& i) O) @( b1 r5 f
ns_marquee=document.ns_marquee.document.ns_marquee26 g3 S9 ~6 L- C/ S) s' O
ns_marquee.left=marqueewidth+8* b& R, L! F& {$ ^) M
ns_marquee.document.write(marqueecontent)
% ~) O) S, v; k0 d8 o+ }" F( X- Yns_marquee.document.close()
* A: J  n2 Y5 ]0 Xactualwidth=ns_marquee.document.width
+ e9 Y) c& W' \% {}$ a" q) g2 f$ X$ [
lefttime=setInterval("scrollmarquee()",20)
2 z7 V- Z$ N6 m' }9 R}1 y# i0 X  |3 m
window.onload=populate
2 q: c$ B) A6 N" n6 }$ o) `  M# m2 Y2 |" X9 |: V, _: l5 Z9 ]
function scrollmarquee(){
( n0 O0 G4 s+ H& Z- l+ t: K! Uif (iedom){
$ D$ y- I9 _1 y+ l! w* ]- cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 H; X* B! J7 G$ M5 t# P/ fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& N( ?. K! x0 C! \2 K8 v" H: g/ eelse
8 {! W, x" z  I! F; E+ q  h  U9 Dcross_marquee.style.left=marqueewidth+83 }/ R2 q) r7 p5 B9 H0 C! q% X4 t
! Z& j2 v0 H6 {  p! E- u
}
2 E. H5 F: K4 l3 q+ X1 I7 N# Welse if (document.layers){, @- ^) {7 L" r, @' _. s
if (ns_marquee.left>(actualwidth*(-1)+8))
! ~/ f1 Z$ C' n# s8 s* W: Tns_marquee.left-=copyspeed
" ?1 c" Y1 B  B2 t  felse2 H- i) e2 g* q: ~* S
ns_marquee.left=marqueewidth+8$ v0 |. G& r# I$ I. G6 S' K
}) p1 k) L5 Z; Y0 D6 K3 ]
}
7 T! i7 ^  C) q0 m5 V# ~2 y
% H& f4 ~; Q3 xif (iedom||document.layers){
8 V3 ^  S% x% e6 P5 Ywith (document){# S. C1 t0 v4 d$ x
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 m. J0 ^  E6 u7 ~1 }* g, S/ z7 r
if (iedom){8 z! B2 B& Q3 ~# a5 z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 S- t6 I6 F" |* I8 O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* q  |+ f+ [% E( o- v. C) J5 G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): P4 ?! \' z1 l# X! B
write('</div>')9 |) t# N, Y$ t/ G4 k2 ^* Z9 @
}
0 j! q* x, v2 Q1 A* ~  J6 velse if (document.layers){  m4 ~/ C4 x) E3 K1 T2 q7 A1 O# q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- s  }- D. |8 T; R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( K" [" Y8 Y2 r. k5 i' x# a, @8 b
write('</ilayer>')6 c* c2 \* T' H; N- ~0 S
}
3 u$ D2 v7 \) r. h" z4 E+ B8 {, Ldocument.write('</td></table>')
5 k5 O0 H+ \8 q3 R/ M, x}
  x( Z9 o/ Z( x& z7 Z( y0 b0 t}6 b0 v. u' b/ f6 M7 C6 A
</script>

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