返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& w5 d; ~" h& z# i. v0 x1 ^* yvar marqueewidth=300$ i1 {- E  D! ^! }. o2 C, X& U
//高度& I" y7 n) n5 s% _) d7 Y- s8 Y+ ^
var marqueeheight=25
; L5 H& r% H1 C! _! I7 s) D) l//速度(1-10)
# p" d3 p4 u% h' ]' ovar marqueespeed=3" P3 `% Y+ M  G; e) g  }2 c( ^
//背景颜色
/ s3 ]. h. K, f" Y2 g) f0 k- w4 b0 ~. Yvar marqueebgcolor="#FFFFFF"1 k) e6 s) X1 _0 Z8 w
//是否能暂停 (0=no. 1=yes)?
' R$ ^1 [8 _7 Nvar pauseit=11 {8 g) |+ |9 G7 Z' b" O/ \! x  l
, K. }* j, V3 M
//修改显示内容
: y; L, \" v7 f- i* H5 nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* V$ p6 s, Y( L

- Z/ M5 r: _! g9 l+ l) O6 B: {  s3 h) Y6 ~9 d* W
////下面不需改变////////////
1 [, |) m& t9 d6 z. x3 y3 c' m# k6 T" o/ {
var copyspeed=marqueespeed- e3 c5 z$ C9 @
var pausespeed=(pauseit==0)? copyspeed: 0
9 W* R, l8 D, m& M4 Q0 S( E  nvar iedom=document.all||document.getElementById
/ h5 j" |6 R7 T0 e3 U9 {6 o5 P. _) R* {5 Fif (iedom)8 |' m7 w% s; |& ?# F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( y, X3 N3 n, C$ \1 @5 b% K, ovar actualwidth=''
+ X1 l* i: m( P8 `" J0 f1 l/ D5 ^var cross_marquee, ns_marquee
' C" x7 E, l+ }& \) M2 D3 ~& `$ H( g- I# ~' H# \5 g3 Q
function populate(){% u4 q; y" ^. s$ U
if (iedom){. a. ]" m% S& N' e2 g& a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& h: r- T, [- _, ycross_marquee.style.left=marqueewidth+8' n( V: L" h( R+ b5 i
cross_marquee.innerHTML=marqueecontent
7 {( H- w0 L+ l" K" V$ eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- \% G+ l0 r5 K: s! K: C5 x}" W& k4 `/ R9 W+ I2 ]) a
else if (document.layers){. h3 A8 i1 c+ P& F* V* o
ns_marquee=document.ns_marquee.document.ns_marquee2
" S1 q6 H( F* p6 M& n( Sns_marquee.left=marqueewidth+8. M& f0 a* \- M* c- W2 Y0 V
ns_marquee.document.write(marqueecontent)" `6 v# F. R8 o- n& ]0 @- @
ns_marquee.document.close()' J, Q: O2 @  l3 p- C
actualwidth=ns_marquee.document.width; k! M# J" a4 E
}! Z% G4 f& i6 S6 I& ^
lefttime=setInterval("scrollmarquee()",20)& U8 m0 R* O3 {7 }: P
}
/ v8 R* I8 M3 V* p8 J% Twindow.onload=populate
. f% k6 o, H4 n' I9 H, s0 ^% i( W3 Z" ]
function scrollmarquee(){
. w) m; [4 N: |if (iedom){
6 I) H' g5 i' N  t* W4 g- ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 R# N3 k1 h' J+ U& i! u" r- U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ I9 p' C) j6 [5 H7 a
else6 Q6 J4 h0 M( J3 y* U
cross_marquee.style.left=marqueewidth+8- {5 j2 M% `+ s$ U' j9 Z

  Q! V# g$ ^6 K9 h0 ^}
) U- y: ]& F3 c$ d4 b4 gelse if (document.layers){9 |! W) z" u2 l' f  w" B5 B5 |
if (ns_marquee.left>(actualwidth*(-1)+8))
$ R' [' ^0 n* Pns_marquee.left-=copyspeed+ k9 I" R2 z; _
else
* L& R+ x& V, q# \& Z  }ns_marquee.left=marqueewidth+85 C1 N) A' O0 g1 k
}% f! a5 }% A8 O" v
}
- I0 y8 o  N  k0 |7 E; f
1 B7 P1 K" Q5 s0 ^5 T" W8 s& lif (iedom||document.layers){2 w) H7 h0 k% G4 ~# s5 i
with (document){
" c% R! n( x/ }$ Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 c7 [  B' _9 V" {: vif (iedom){) Q  j- I$ I" u4 W4 l
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): N, l, }, E5 Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 S- X. W8 P6 kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& n* p; q6 R! I7 B2 Y. l  u! B: I/ \write('</div>')' J) l6 n& i. z5 |0 s  x
}$ \. |& I! |, ], X
else if (document.layers){! |$ ]: \" c0 {2 e+ C$ ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ p$ i1 \; s" }+ x+ \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); p$ j: ~% Z$ h- c3 [0 l
write('</ilayer>')
' k/ G  @3 ^6 Y5 Q0 C}
5 X+ w* Z3 f) U. E: ~' edocument.write('</td></table>')
# V& v& S. T5 @1 i! O}# U+ ?; c8 V$ h: S) R
}4 J$ H" c" R4 J  p- Q2 E
</script>

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