返回列表 发帖

网页之跑马灯文字特效

//修改宽度; D4 S0 w/ l4 Q0 O# @
var marqueewidth=3000 W) v  M- w# u7 h" T
//高度
- d2 K! I# \1 E5 wvar marqueeheight=25
7 z2 t# F7 D6 b. a8 _//速度(1-10)5 X6 h; _, I2 P
var marqueespeed=3
9 `& R2 m; T) j+ M( m" H" ]//背景颜色. A% {% ^: P+ t& D
var marqueebgcolor="#FFFFFF"7 \" D+ Y0 D% o3 k9 a
//是否能暂停 (0=no. 1=yes)?
$ V# F0 `! @! K$ g, c7 `var pauseit=1
5 I0 q, l7 z6 T# H2 Q* Y% K- W6 h3 Z7 f9 W7 j
//修改显示内容
8 K: C. R( Q, U! Y+ B3 A) Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 E% K- k+ b% k  x0 z
5 j" O5 p; q8 i2 p! V0 V: N* Z9 W; ?# m/ k- q/ f; a, n6 @
////下面不需改变////////////
7 a+ @( N3 u7 b% |8 J. r
# X' p+ b3 B# X. Q4 [1 vvar copyspeed=marqueespeed) @$ L( g1 K( U( U( H- ^
var pausespeed=(pauseit==0)? copyspeed: 0  Y- S6 U! ~7 q1 z) O- R
var iedom=document.all||document.getElementById
3 v2 @6 d. A3 R0 uif (iedom)* f. }$ T, `& H+ B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 D6 d. p6 q8 e" {
var actualwidth=''
; b  I  F" ], v& |6 {3 g5 Hvar cross_marquee, ns_marquee
) G8 L: F$ u" d; S" d  i, O0 ~5 d  Y7 M
function populate(){; I7 D9 G: p8 w9 s( h5 D! }9 ?
if (iedom){! X+ B1 ~: F: E0 \: K5 V' v) }! Q; E
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ |" c0 Z1 a1 q9 Y8 W; Q% Qcross_marquee.style.left=marqueewidth+8  q! m$ I8 s; y% o
cross_marquee.innerHTML=marqueecontent
) {7 j% g9 J' b" f" {# i" Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% F; I$ l: m  M4 q8 }! ?- _. D
}
* |1 S- d1 `' P3 Belse if (document.layers){
; r" q* v, \  h4 xns_marquee=document.ns_marquee.document.ns_marquee2) i4 c+ @: k! w0 \% {3 ^2 i
ns_marquee.left=marqueewidth+8
9 r) A4 V  V  t5 |  ^ns_marquee.document.write(marqueecontent): {' K' H3 y# ^8 ^; V
ns_marquee.document.close()& R4 A7 Y; B, _& K  m
actualwidth=ns_marquee.document.width0 T, p& o6 r: P" l% a
}
4 {* Y) j7 L+ P" ]) l& klefttime=setInterval("scrollmarquee()",20)8 D* K% r7 S; d1 E9 i
}# W6 W; y% G5 K. p
window.onload=populate! g' e$ C2 |. ~& j
4 k( E  _2 F* g7 X7 i
function scrollmarquee(){
$ J/ B: ?  ]6 J* Dif (iedom){$ Q8 _! I% R$ W  K# X3 ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ [9 V7 E1 [6 t% J: \5 H  ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 ~- r/ O# Y8 Pelse  H  E  y1 x" T& ]
cross_marquee.style.left=marqueewidth+86 J/ I; j2 P7 w: w2 @  [6 N1 E% {

6 S% y) }2 B2 j3 L: `3 t}
) Q+ B0 g1 T8 |, O! Selse if (document.layers){
- Y5 z8 m* Z8 }+ [* S% iif (ns_marquee.left>(actualwidth*(-1)+8))
6 ^4 ?! S0 c% n5 O7 y! i8 Ins_marquee.left-=copyspeed
( j7 B0 w2 q7 D* m/ ]else( J3 m& }' ~/ r2 ?
ns_marquee.left=marqueewidth+8
+ O  u8 o6 [9 s$ O* h( |}: N0 r! t- |" W8 I( Z
}5 ]' ^% N8 ?! x! F: c. T
8 k( b: d+ {; W( z/ J" ~
if (iedom||document.layers){( A7 ]# V2 _( @( f
with (document){
# z1 I6 L& B+ Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 f" U6 I& l! Q
if (iedom){+ i, Q  p5 P  T) B) [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# B% r4 s" l; K5 ]/ b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* B0 |% v6 n( O# V' dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ k- l7 f2 B2 F5 I; f* C
write('</div>')2 U6 ^, K# m: {. b
}% ~, P  o3 D& n% I* z
else if (document.layers){
* K. J. `+ Z3 s1 ^* D% _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 P5 o# r! k4 A" h3 c% x: l1 y* F
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): d* B+ ^5 w, q. H
write('</ilayer>')0 O! Y: e7 y; l! S9 |' b( Q
}
2 |" R8 G3 N- e) n0 f- ?( n6 Wdocument.write('</td></table>')
3 j2 ?' m+ f: M$ i2 G9 O) P0 Y}
) a$ W' v3 {# q6 ~' p( V7 Y  H}
) B% l/ j1 `' K* ]' }8 u/ l) h! ?</script>

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