返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 Y2 l$ g4 M: y; O( j
var marqueewidth=300
' x2 ~$ L1 }7 q9 ^) B1 `//高度- B: @; e) ^* t
var marqueeheight=25
$ Q* U# Y9 V4 N1 h2 @; k6 m5 I, n//速度(1-10)
7 I9 w, x1 ^, Y. z+ ^9 k* f8 h8 jvar marqueespeed=3/ z1 w1 e* r. H0 m' Z: _9 |$ `8 o
//背景颜色
  E* J- ~" L7 l6 G& q5 gvar marqueebgcolor="#FFFFFF"
: s, Y) M' y2 B//是否能暂停 (0=no. 1=yes)?
" h4 G' _3 S/ o1 U. A( c: Ovar pauseit=1
5 e; ~. S8 n- M! H  E" K: K) K
& B* k' [7 g/ \8 \//修改显示内容/ Q& h: Q: `  P) M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ R% T, u, _* S

/ A# f1 ?& D2 ?3 Z' c; G$ M8 R2 x+ Z! w5 @
////下面不需改变////////////* D; L  m, X& H) u; A3 n4 J

  ]$ @/ Y9 E# Y, t/ G" K  L7 }var copyspeed=marqueespeed
/ m9 Z" p2 P7 ~' _9 [var pausespeed=(pauseit==0)? copyspeed: 0( f' j, ^  ^: ]
var iedom=document.all||document.getElementById7 D5 w3 v/ c; Z$ v+ q
if (iedom): e5 M4 k; b! t$ F1 @0 @, v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 e1 M& O/ Y0 j1 {: Z# Z' f! |var actualwidth=''% [1 q0 [0 g; E% a7 X/ f5 [- w1 O* o
var cross_marquee, ns_marquee
2 R; X; B4 J. X! Y5 a  }. J& G' o& b  U6 }
function populate(){1 {6 n8 [: D& p
if (iedom){
4 a. s# t2 d: n5 W; Ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 Y  @, S0 u! |! ?cross_marquee.style.left=marqueewidth+8
2 A. L6 l/ r8 t; `+ M" r% |cross_marquee.innerHTML=marqueecontent8 t" O" H/ I% k6 c! ]& L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. Y' \( d, c1 j8 l& v$ ^
}
& x3 f# D; P9 J) V6 Ielse if (document.layers){6 h4 D- h& y$ Y  F0 `# H
ns_marquee=document.ns_marquee.document.ns_marquee2
9 ]  f) I7 `. S+ Z) m( ins_marquee.left=marqueewidth+8
  E6 [& Y$ V) Yns_marquee.document.write(marqueecontent)
) W5 ?3 i( I2 f. l, U( @5 E: {ns_marquee.document.close()
9 s3 ?! ~9 r' N9 ~5 H9 nactualwidth=ns_marquee.document.width! i: S3 J5 l* A+ C9 L
}
4 i3 t5 d$ i+ b4 {lefttime=setInterval("scrollmarquee()",20)/ c* M# m. Q) H8 w
}" z3 F- p2 K5 k8 x8 F& @% @
window.onload=populate
8 s; L( ^4 B  G( e$ K/ k  w0 Q, d( y2 B8 z# U+ d
function scrollmarquee(){
9 t. ~, T) X8 i$ \5 @/ D; tif (iedom){6 z2 V8 B$ L4 ]& o9 W+ d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 U+ w5 G+ F6 n% |/ E1 J/ g* R& M. V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( }. O1 N3 _/ G
else; G7 _9 e' I% y) |/ q
cross_marquee.style.left=marqueewidth+8* [! {! z% d0 A
4 h2 G2 S+ T. q# P$ M
}' I( K! Y2 E! {. T- n
else if (document.layers){+ m. E# F2 d; T
if (ns_marquee.left>(actualwidth*(-1)+8))+ W& W, B3 p" J5 D0 y2 R" n
ns_marquee.left-=copyspeed
$ X# t6 r$ Q" y9 Helse' G0 N* y8 {4 F" p8 `6 a2 }
ns_marquee.left=marqueewidth+8
% \: x$ a: ?: q3 s}
) r7 ~% S, e5 J; x& X9 Z. v}# s! O. @  x: a6 X, e. y

% {- }3 n' z' I9 y8 S+ ?if (iedom||document.layers){- \5 q* ]% J& E6 h% m( {2 K
with (document){
5 d$ h9 u: Y) `8 |' tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): ~9 Z9 u2 j) D: P: a3 W- q- D
if (iedom){8 `  o( @. H; r! q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- r, J9 h( e2 {- A, O: C0 Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 ^5 W0 i, M" ]) ^+ h* J" o) twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 H- S$ i' C2 ?, o* ?  W# u" Nwrite('</div>')
$ X& }3 ]5 ]. b: x, K}- z4 B) P$ }! Y
else if (document.layers){% e! ]) a6 G. k: S3 Q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): W6 ~1 u  D1 Z  J0 M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), B3 G3 i: D! {4 j; e
write('</ilayer>')
2 _" x5 \  D2 t  q}
9 q" z3 U" n% s  p/ X& idocument.write('</td></table>'). L* O- M7 y/ o9 f$ F: J' s. d6 V
}+ u8 @3 S( z% K8 |
}5 B* A- C% s* Y. d/ t5 r+ z
</script>

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