返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ O+ E5 G/ g( W% Y2 R
var marqueewidth=300
( M* K% j: u9 F# V% a& d* d& G: ~; o//高度' K6 h) i' M6 \6 C9 d
var marqueeheight=25
' ^5 B8 I/ v; ^//速度(1-10). I2 J) `% p3 \2 ]
var marqueespeed=3
2 |0 f* s3 `2 D5 f, \% [. @//背景颜色
1 ?9 `& P: A5 E: R- ivar marqueebgcolor="#FFFFFF"- u2 L, f4 u. L4 T) A5 @3 b& P
//是否能暂停 (0=no. 1=yes)?
9 a6 {; C) L8 W9 m. t, ~& t" Ovar pauseit=1
$ H( j- h8 H. `! I
0 H& q  a5 ]: H/ ~+ p3 g# R# z//修改显示内容6 E( d( @$ L0 m/ P0 L9 }
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 Q. o: ]  @6 v4 w" f
, E- S, m( _6 i$ G. T* N+ E

6 y* t( w3 q9 o+ |/ y////下面不需改变////////////& @# U& b* k8 ]( Z9 k
+ |$ F4 z! W3 @
var copyspeed=marqueespeed& s2 ?  @5 Q2 b+ a- c  a
var pausespeed=(pauseit==0)? copyspeed: 0
7 D! L1 r# w$ ^& v9 pvar iedom=document.all||document.getElementById2 s8 G% U( D" U0 X) {
if (iedom)) ?8 P+ n4 T8 N9 I! F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ D. F* C8 v4 O# F" c) x7 d5 Pvar actualwidth=''
, }5 X1 o0 X: \1 k7 ?' `3 Wvar cross_marquee, ns_marquee
+ ?" Y. \1 I8 R/ D$ Q* @0 F: f
function populate(){
/ h) O* n, f5 t5 d; a+ yif (iedom){. Y  q. I3 k% u: X6 i6 y! w- k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; {. h  e4 q# x2 u3 p$ \cross_marquee.style.left=marqueewidth+8
! K. j2 Q! t* k8 n; z! Vcross_marquee.innerHTML=marqueecontent9 \8 s$ T; f2 I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 Q' \- f4 b. o! d( j
}9 p: b6 s5 u/ H+ O' B) C
else if (document.layers){
$ ~" _9 ]- }0 L* k$ rns_marquee=document.ns_marquee.document.ns_marquee2
1 B9 |' Q4 w, a  l0 j, P; Cns_marquee.left=marqueewidth+8
) r/ c+ t8 r. ~0 Q' B& Gns_marquee.document.write(marqueecontent)8 ^! I4 W$ r- w9 \  ~7 k
ns_marquee.document.close()0 {  a9 w/ ~: A$ J' f
actualwidth=ns_marquee.document.width6 q$ Q0 Z0 w) f0 |. I4 l, @! U; C
}
+ g- B7 e# E( n; l& k3 slefttime=setInterval("scrollmarquee()",20)8 `$ F& m' ~1 g, P) m) E
}- c$ b* Z0 U4 \
window.onload=populate
1 X+ D4 a% H- s) ]9 S& |' ]8 a
function scrollmarquee(){
4 o; u& Q0 M# W0 x- Dif (iedom){5 P/ Q' h8 {8 k6 K- j* R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( U, I, R2 x; across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. r1 A) C2 b5 D1 K( O* Z8 I, _
else
( Z6 {  h* I+ H8 r) O2 a5 o2 ^5 Gcross_marquee.style.left=marqueewidth+8
. ~9 E+ z* F$ m+ D- I4 S! m  B6 J5 A: D% Q: [7 t5 `- P8 }" s# |
}1 R# P+ q) Q/ X1 `# R4 E* |- D5 h9 ~
else if (document.layers){
9 n$ E" p! G% M! {if (ns_marquee.left>(actualwidth*(-1)+8))
2 Y5 V, e9 E! M6 X( h. }ns_marquee.left-=copyspeed8 P) R* N; A7 f2 S
else4 M, u+ }, m9 i+ f/ P
ns_marquee.left=marqueewidth+8
5 a4 L! Q7 X% G* w}
7 p9 f) K7 n1 I  E}
# w4 E0 b% v! j9 ]$ r, B( L3 }6 r. V( a; ]& H) ?; l
if (iedom||document.layers){3 y& p  I& ^! h- v* R
with (document){
) Q+ b  j( J9 V" Z) l2 g) i! ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# y2 }/ y. s' w5 Z8 Y& O
if (iedom){# b! M5 b5 f" Y+ ?0 O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 P& [, |' ~/ k% u2 }8 H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. k3 S3 ]/ B* h2 W* Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 g) r, v9 t% H- Mwrite('</div>')
- w& w. A0 l6 z; s/ S}
. k( o4 q* `! n# Felse if (document.layers){
$ q( |" @' M' K$ H: Y. B$ F% Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: s0 N/ k/ Y- `5 ~4 k: nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# {+ o& [+ n7 e& N! Y) p; Z
write('</ilayer>')
5 r4 d5 d5 R3 R2 w+ B0 `}
# x" F: H+ W, |3 E& ~document.write('</td></table>')
( _$ `) ?4 E! D1 i$ \0 U  G}
4 I; K( b. @; M! ?1 d}# K# f- T$ s# B! n: G0 H: y% z6 S& g
</script>

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