返回列表 发帖

网页之跑马灯文字特效

//修改宽度% p1 B9 ~8 b/ [+ G0 H8 h8 o. I" C
var marqueewidth=300$ ^& ^; r( r( B: n; i7 m0 P
//高度
: [% Y( |  @# l6 Y6 y% w& nvar marqueeheight=251 ]* r! J; I- k$ A
//速度(1-10)# R) L6 f; v+ J7 J3 M
var marqueespeed=33 g) a* Z$ k* K  n! _3 u
//背景颜色
5 w" \+ |; n+ v$ @var marqueebgcolor="#FFFFFF"' [, K9 c' ~5 Q! d! @7 L. v
//是否能暂停 (0=no. 1=yes)?
. }1 c. }0 k) Vvar pauseit=1
8 \0 n6 |% h: ~. O% a) f! V! P7 S, W4 H" f, |: H
//修改显示内容
  R, d1 e- u- ]& o! s! Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 ]3 _+ ^( Y) g' V% P" `; |- c
- D* }/ z/ C2 J; B
5 n6 Y$ \, ~# \# p  n, o' L
////下面不需改变///////////// R1 G/ G6 r* l3 T" E- E- v
! b" M4 g1 C* ~  V
var copyspeed=marqueespeed0 Q5 W' Y6 R. n& r& q/ l. S
var pausespeed=(pauseit==0)? copyspeed: 09 W2 n& B' T/ S
var iedom=document.all||document.getElementById4 R2 ^. t; q' M+ s2 D! K
if (iedom)4 ?  S. q9 ]7 v+ J: k, ^$ r
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 k" ?: Y: g2 H3 ?( ~
var actualwidth=''
  q4 c, D5 O5 wvar cross_marquee, ns_marquee5 n1 v7 v9 X& q1 v# u# F

+ A" c) t* z+ }$ `' g( @function populate(){( H4 G7 F# J8 v+ |4 n7 E
if (iedom){4 F8 C6 R5 h9 O: s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! P  S% R! ]- l; c) J# y4 b2 G2 icross_marquee.style.left=marqueewidth+8
: H) D2 E) Y, f$ R( O4 `cross_marquee.innerHTML=marqueecontent$ W# P( m4 ?% F' q$ |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ p5 X1 J2 L+ K
}0 `+ M% G4 T; R- k4 B$ X' q2 Q
else if (document.layers){( t5 @7 p+ `. E
ns_marquee=document.ns_marquee.document.ns_marquee20 ?/ p8 g& Q+ W
ns_marquee.left=marqueewidth+8
2 o  {! }3 Z: X, Q, }( }' x4 jns_marquee.document.write(marqueecontent)2 c1 B' d- k) N" C) l7 W, ?
ns_marquee.document.close()
0 E9 g' ?- h+ Bactualwidth=ns_marquee.document.width
& H4 u* Y. v7 H}
) ^/ R( ]! `6 A: f' Xlefttime=setInterval("scrollmarquee()",20)
/ q6 g# L; [  D, Q, D}. L3 L2 {0 j' g' B; X) m
window.onload=populate
& X! @" N9 G+ v( r! |6 f- ^, I5 H; g  k3 k$ B
function scrollmarquee(){' s4 L/ `# ~: v( w
if (iedom){+ I0 x, v& j7 k- c/ o- i; A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# l3 T. l; [2 J2 L; t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& I  c, _2 c8 S3 k" v
else. X# l+ O$ c1 F
cross_marquee.style.left=marqueewidth+8
5 D! F0 x2 h- I! Q: j0 X1 t7 F  r1 k- v, U* F  X3 |
}
' x& P4 y. G2 M: T' o; aelse if (document.layers){
# K& `3 U* J  v/ }: A, Bif (ns_marquee.left>(actualwidth*(-1)+8))
' B0 p5 \1 R+ c/ a. @9 H9 hns_marquee.left-=copyspeed
% _- a3 h( K4 l/ f. l* q* D7 F( B1 Nelse8 O; b5 i1 R; q9 D5 \8 J/ A0 v  N
ns_marquee.left=marqueewidth+8
- H9 n' k0 _7 v5 _# u0 G5 {8 k}
0 x& m% K5 k9 I; s, C; h}5 ~# I  A- E5 x8 \+ c7 I* o

1 h9 Q& ~+ ~  C+ u, @if (iedom||document.layers){4 z+ r+ x9 \* ?0 V( g
with (document){
1 R/ ]: N- M4 M  O5 hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! {( T5 D# w4 A  qif (iedom){9 \: Q# f! m2 A* S3 }( y1 a7 E7 E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 E# M! M: u$ e( |, r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); N' R7 h$ c6 i
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: I! b' W  d2 a8 Q% @3 {write('</div>')
! i! r; D3 {$ d2 k}; |/ d$ ^9 {' |3 v1 g
else if (document.layers){
( h/ k$ t  S/ K1 ]  Iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); `+ |  h3 L# c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 L. O5 I# u" P# \+ n: Dwrite('</ilayer>')
1 T+ z. F9 S6 R; f6 m& K( P}/ I) [9 y: D4 L, _4 B5 ~0 n: u1 y; Z
document.write('</td></table>')3 g9 j6 T, ?+ B3 E1 [6 J* y8 _
}6 O, W" i: }; T1 E
}
7 O, ?6 K6 I% O3 e* p, B; l  u</script>

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