返回列表 发帖

网页之跑马灯文字特效

//修改宽度, x  ^+ Y' S' d0 Y! ?. G1 E
var marqueewidth=300/ M' t# g* k7 s4 m, F" `
//高度
4 |9 ], U4 I6 V7 ~2 l4 D0 Vvar marqueeheight=25
4 J! K. F* S& M2 z# [1 I1 ?//速度(1-10)
+ w. _( @; R  X  u7 |7 Tvar marqueespeed=3$ X& u+ x# i, W1 m) X, w
//背景颜色
/ Y) P, q2 x4 k4 Bvar marqueebgcolor="#FFFFFF") r8 ^  |; Q! e$ c" F6 Z+ ?
//是否能暂停 (0=no. 1=yes)?
" R/ ~; p' ^; u' H3 \var pauseit=18 Z. t; ^% w; F. B  Q& l- b
& `  l# y+ s; ?/ m. e+ O4 k& g
//修改显示内容
/ [* a9 R/ Q, R% A. }var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; Z+ M4 J3 z/ _$ y8 }! o2 e% P. q7 o; J4 B. B6 X5 C2 X5 m
& L+ E; s) B4 Y! P! ^# E  _- m
////下面不需改变////////////. [( a* J1 h, O0 U+ u' l' \: V
( ]& i0 {# G0 _. ~4 a% `
var copyspeed=marqueespeed" |' Y* [$ z& A' A/ ?
var pausespeed=(pauseit==0)? copyspeed: 0& D- I1 w" g% p; p/ H6 E
var iedom=document.all||document.getElementById) O) H7 l/ u6 u
if (iedom). _; K1 C+ M7 D0 g" V& \6 G2 f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 r' S# `* p. ]' M
var actualwidth=''8 E3 x. u6 L& Q4 @( o% L
var cross_marquee, ns_marquee8 V# H; b9 t& z8 Q& x

5 a: q* d. m4 Z' o, Xfunction populate(){3 A' O% l+ x. R8 x. t4 c
if (iedom){5 V7 h" p$ h1 j" X( A4 s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( ~" C- _# g- j5 l. R9 `cross_marquee.style.left=marqueewidth+8; i0 m0 R2 O/ G* J, ~# d
cross_marquee.innerHTML=marqueecontent9 ^- O$ n2 M9 u0 M, {. ~- v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 s  C$ D* [! e, o  Y/ s5 A6 Z- d}
- L1 n- ?7 C) Q  Z$ z: R% felse if (document.layers){
9 x) ]3 [8 x0 y1 Lns_marquee=document.ns_marquee.document.ns_marquee2
8 i; U( C& {6 o/ _, ^, g4 A) nns_marquee.left=marqueewidth+87 N' d+ C6 D0 f
ns_marquee.document.write(marqueecontent)
4 ^" ~! ]8 Q+ ~ns_marquee.document.close()4 Z5 V0 M# T- \
actualwidth=ns_marquee.document.width
* Q/ A2 F, @: W7 X}
! ]+ d. ]& f& `# }2 C! Llefttime=setInterval("scrollmarquee()",20)5 V+ n: a8 S( k& f6 t! a
}. H6 y, K( o5 Z2 N( P7 t
window.onload=populate* z/ L) K2 a0 N, L

6 B% ^" A/ I, yfunction scrollmarquee(){  K& v" n% o8 B( m
if (iedom){- z4 B( h& h% P- l  R, ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# P* x9 q' D& _* hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% n; [) ~; F( r/ W
else# U, V4 s& v5 Q7 H, [/ N
cross_marquee.style.left=marqueewidth+8
6 i$ i0 F/ P  v$ G7 C$ C: L1 I. y
& Q( d/ J0 d0 _5 O' N( p}+ |; u! I1 o' u* F& K  [, S4 `
else if (document.layers){
, o% |: I3 F/ ?1 vif (ns_marquee.left>(actualwidth*(-1)+8))$ f7 }! p2 J% q+ I  J
ns_marquee.left-=copyspeed4 n4 L2 c* h3 L6 Q% l/ v
else
# \: K( _% t1 I/ h1 X3 |; Xns_marquee.left=marqueewidth+8! O4 k9 S" ~8 [; G5 V
}
/ l$ C6 j- G. D7 W  \0 ^}$ t7 k8 O( y1 ~/ I1 ~: ?
. D" ?! \' E: h* V
if (iedom||document.layers){$ q" _% Z  `# b3 |
with (document){
" m+ a1 d: }9 j5 G% L( J* `' Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 {. z5 a# }; oif (iedom){
. H* K. w0 |2 n. T6 fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' G. r0 ^3 l* o# R+ c6 n  zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 @7 p* r! h4 g$ `8 B9 [" [( U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  ~5 t- i% F3 e+ D1 }1 s7 ]write('</div>')7 f- o% \1 N) q$ l# l' w
}
4 m0 l3 d8 G+ k/ Z" Y/ d! U& i" u5 Qelse if (document.layers){, o+ ]. }; A6 E2 c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- S( C" n, Y- Z9 C1 f0 B* o1 `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( I1 q3 J# x/ \( J+ P: d& swrite('</ilayer>')
) n5 ]; ^. p% x5 x}
1 K- l+ @8 \3 N9 sdocument.write('</td></table>')# J, `4 `& {$ p4 [, a9 a
}$ n2 |5 I; x4 f9 s5 b* z1 Q: r9 j9 ^
}
! u  |* a6 v0 `; H2 y, S</script>

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