返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 t% O5 |2 ^( Kvar marqueewidth=3009 K- o& }# l/ w/ E0 U' ~" f8 A
//高度
; ^+ q; q6 j1 P0 |0 \. C" ovar marqueeheight=253 X) z/ @5 e) A1 B$ N0 ]; t2 D
//速度(1-10)2 K4 ^0 ^2 R0 G7 L
var marqueespeed=3
) X  [. H* n  ~9 r$ w. A  ~; V//背景颜色) d  q) ]5 F# s2 g
var marqueebgcolor="#FFFFFF"
5 M2 O' @; ]( n7 ?' M3 {4 J7 ]$ V//是否能暂停 (0=no. 1=yes)?6 i7 j! I2 w5 c+ {" ]
var pauseit=14 J0 j& e9 \0 u5 k" Z

, b- A# Q$ h  P$ X5 s) G//修改显示内容
/ E. [& R. l; @& J5 N6 X- x% yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- r  w; o' {" m; l1 M( M  K
) s" U) U0 H# u% y

- `& T) B7 O7 m" |, X. l, j////下面不需改变////////////
$ r5 d* o8 F- F4 l* ^* x
" x* p4 y- R# y( {9 y2 o+ m5 xvar copyspeed=marqueespeed
5 ?" s& Q1 r+ x, q2 B) {var pausespeed=(pauseit==0)? copyspeed: 0
1 m3 |4 y) x! j3 J# xvar iedom=document.all||document.getElementById
& ~9 D. O+ P3 F( _3 }if (iedom)2 i  R* o6 ^. ]
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  J. h/ @- a5 y& v' q* r- B; E
var actualwidth=''
$ r% P$ t) D, G5 u2 K# Ovar cross_marquee, ns_marquee
) V4 Q- F. U3 c8 U4 V& V
  d& r) g( |5 T4 ~1 L; L4 wfunction populate(){& q: J' b2 x% j. _
if (iedom){
& ?8 h# y; z7 P& {2 gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' Y5 c1 \) r% ~3 ?cross_marquee.style.left=marqueewidth+8
2 h. e' f3 z/ g0 tcross_marquee.innerHTML=marqueecontent( b5 S( U% v0 e$ f5 S) O/ e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 B6 i2 j" z1 l/ d+ a' S9 W8 n0 E& \' }
}' L4 ]! S% \9 D. W. `
else if (document.layers){& |$ K3 A9 q0 n* d0 v
ns_marquee=document.ns_marquee.document.ns_marquee2
6 }. @+ B+ A" G) m0 M/ F) Lns_marquee.left=marqueewidth+8
5 u5 j8 \6 k1 z# F# {, Gns_marquee.document.write(marqueecontent)8 y8 ^' n, C, u# t4 E4 \* a2 w
ns_marquee.document.close()+ {' u' F% V% I# {9 N8 u  |# L
actualwidth=ns_marquee.document.width8 U6 m5 x5 |! z, a: e: m6 t- E
}  @4 j/ F. |( t( `+ g5 O
lefttime=setInterval("scrollmarquee()",20)
/ d! \- g' I! m7 ~5 B}) A5 m1 G2 b3 ~; Y0 Y  k% l
window.onload=populate
* h$ v9 ?3 R/ a) Y
" J' M  y# R. G5 |, `3 Pfunction scrollmarquee(){
. {( e" R0 q4 `0 _- B& k( tif (iedom){
8 f6 C* C4 O9 k4 `. l. y& Z9 O. r, @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. t# x# Q8 ?& x5 ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& V7 \% _5 b! }( M- n
else+ \: G" h* B# \+ P
cross_marquee.style.left=marqueewidth+88 i7 m  v8 I0 G. t9 Y
2 S. V5 R. T  ?0 T$ H2 b6 j+ E
}& o- `+ }/ W* A- X$ R5 i0 N
else if (document.layers){
6 z; m" m& u) I% W; u/ K( ~# }3 fif (ns_marquee.left>(actualwidth*(-1)+8))
$ X0 w+ _" J3 Y' Nns_marquee.left-=copyspeed. E7 C% f/ S; C" _+ H+ R, k
else
3 {6 l% q0 m+ `% ~7 s; yns_marquee.left=marqueewidth+83 B- o" ?' Z( G+ |* w4 P/ }* j  L
}( _5 @$ O/ y9 o0 h3 W) h
}6 s* x5 F: ~* j9 ?
5 V& N2 G* Y- M
if (iedom||document.layers){
6 O  s0 @6 c: l0 i' C" xwith (document){; }( }  u! h! `
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% Q" ]5 @9 Q& v$ a3 i7 k+ r1 s7 J: T+ Kif (iedom){: [# @' Y! b2 K( k3 j) C+ o" v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 @) E/ i  w' E# v  fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ o+ y/ D7 n6 E, D/ A( r) J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 y6 Q* G. w# p; ]0 `write('</div>')
1 |/ Y9 g! a$ R4 J}
9 U7 C- ~  ~8 e/ G5 xelse if (document.layers){
) x. ]4 y- |( _' R1 O+ _! ^# x! I( ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 T: m2 H% G9 M3 t3 Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 }$ J* R5 }8 `write('</ilayer>')) H2 K# o; s/ F1 q# s' ?
}3 l9 x& M; K, Q1 x$ d
document.write('</td></table>')0 i0 N5 i5 g4 [# K3 |# X3 V* _' u
}
# e0 D3 X. M+ N}
, M- s( G+ j+ H% _</script>

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