返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ e' ~9 N6 L* P+ K7 {+ j7 {
var marqueewidth=300
$ b+ ?* Q$ Q7 J//高度5 d5 R+ I  H8 j9 r. ~4 l
var marqueeheight=253 j5 G, S* X; _6 ]5 n
//速度(1-10)
/ P2 k* K* l2 N4 h; ]var marqueespeed=3: \; U3 X6 h% Q' e0 e/ a; F
//背景颜色& `: O9 U7 \4 C' r3 A) U
var marqueebgcolor="#FFFFFF"6 z' k6 x3 x3 V& E9 G
//是否能暂停 (0=no. 1=yes)?
2 o6 j9 K- P- u* C& c/ I. o) wvar pauseit=1
& [6 H# D1 W. I: O3 S
8 s" o! Y2 u6 i  Z9 ^//修改显示内容  f5 Z, ~/ C& r+ l; B( `( _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; y0 F' h# C7 X- I* q' |: ]4 w# v+ P% U3 K0 r/ Z6 c

  h- K+ S' L* d2 e+ X$ q8 s  \, r////下面不需改变////////////
9 F# w5 C6 m7 N/ J" g! w6 C+ f( `; W9 @1 Q
var copyspeed=marqueespeed
, Z: O3 S* }9 ?9 k1 b/ K- ~var pausespeed=(pauseit==0)? copyspeed: 0
4 `) T! g; y4 e7 D, [var iedom=document.all||document.getElementById
( Z; Y4 l) y1 i( {9 eif (iedom)
( Z& K0 J3 X9 C8 mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ f$ w( \2 r  S3 U& {6 [7 c2 O
var actualwidth=''. n( l" A5 V0 v/ H" h2 r3 X" _
var cross_marquee, ns_marquee
/ m9 {, E% b) s+ E8 Y% V$ T) [* e7 K% @- p" O3 T* X
function populate(){
9 p8 ?3 H, Y' E! _1 b; f* J5 \8 k8 Qif (iedom){- }# u, t3 v( A: i2 s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  |2 E- b7 {! p4 V. Y& q
cross_marquee.style.left=marqueewidth+8
2 u3 o1 |3 P# U8 q: Kcross_marquee.innerHTML=marqueecontent! p+ X' T2 Y2 |5 u( R, P5 b, t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 [: X) K! _! E: N( y: h
}1 R; K: U6 ]( y% T5 R
else if (document.layers){
. y, A- q7 ~2 n: ~. I5 _  Y6 Ans_marquee=document.ns_marquee.document.ns_marquee24 a4 ]+ m0 k/ _1 b! E( \
ns_marquee.left=marqueewidth+87 z5 I, \! x$ D& i& B/ P$ Z
ns_marquee.document.write(marqueecontent)) k; n6 K# m5 j- \3 X1 J2 D/ r
ns_marquee.document.close()! J2 m+ h2 Y' l. F. M  A
actualwidth=ns_marquee.document.width- D5 A0 U/ B$ C! ~- m
}" y' O  Z: c; u4 d* t
lefttime=setInterval("scrollmarquee()",20)
" ]- d$ D  \$ M! F! _; `4 ?+ }8 i1 q5 v}
6 h5 n; u  R! [, i' G- Twindow.onload=populate
: s3 p: S1 i( a! H! S" z: u. k" i1 e) N% n
function scrollmarquee(){& i, p7 L$ `1 ?- W9 u  u; G7 T2 z
if (iedom){# S; S8 ]3 n  ?3 G4 L+ ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ M, }9 @( y0 ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" A/ [3 p0 @4 _) A% uelse
, y" J' M. s. wcross_marquee.style.left=marqueewidth+8
4 N+ q( T& g; J; K) o. k
" Y8 q; R) ~3 V3 b' d}
* G- G; h$ A: {9 T* y- Ielse if (document.layers){
; m6 q, S2 Q- m: qif (ns_marquee.left>(actualwidth*(-1)+8))
0 Q' P0 n  h- E# E& h/ _9 v! h1 Vns_marquee.left-=copyspeed8 C( d! c" k  ?. {4 f- W9 s) g* k/ ?4 Q
else
- o, @( s& d' u  D8 o0 p/ |: a* Rns_marquee.left=marqueewidth+8* b* z3 ?9 B* k# B5 R' z; [
}( y2 X8 g, r6 n
}
8 ^+ b: f  w" v' N/ n
. A7 i' K+ m! T- z' N7 ?if (iedom||document.layers){3 i  r- B0 J  x/ K: [$ I" G
with (document){; W0 v" Y" L+ V9 A& r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 U' S* J; _& k( ?+ [, wif (iedom){
/ I6 N* w3 q& O$ X0 m& Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, p2 Q0 Q' n! D+ qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): g: f7 `* d& R- i* d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ c0 {5 f3 Z+ m8 Y! ~4 l
write('</div>')
, H5 h* K$ k: O- J}4 t" H3 E7 J: p( [' d( m" ], ?( J: O
else if (document.layers){( _9 \7 |) q( O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* e( k  G! W, y, f, N1 Z/ R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 B; t4 I$ L% P2 z! C+ mwrite('</ilayer>')
# Q# Z8 o/ s* F$ P" B}6 {9 k0 y8 X6 |3 U
document.write('</td></table>')( l2 Y  J7 ^1 N) [+ e6 O, H; Y3 \
}
9 O4 [6 D' H: ?  Y* r( @; o# E}
+ G! Z$ z3 P! h</script>

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