返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* N/ [1 E. _3 }# ], a8 z! Hvar marqueewidth=300
) g3 B1 E$ O8 n# f//高度
% D5 W+ r/ ]2 \" H$ A6 hvar marqueeheight=25' I# w- [$ Z* e2 H
//速度(1-10)9 i" j8 B% ~; Q& a* H
var marqueespeed=3: h' D# p9 b* C8 m) }$ [
//背景颜色8 }# |6 ]* y, b8 |# Q* n: Y; T
var marqueebgcolor="#FFFFFF") Z6 K/ H% m. {* K5 g* l9 t
//是否能暂停 (0=no. 1=yes)?0 Y0 ~+ ~6 Z9 U* c$ ^" k/ ?
var pauseit=12 B1 @  x/ e) X: Y
/ S: w+ ?8 c6 i( u
//修改显示内容7 b1 W* x- e$ y4 v$ O. U4 s. G2 o9 ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; ?" I$ A1 o4 U. K$ \

' |/ n# I- M! k4 f2 G/ g: P" \8 X& f4 R3 p; P# L8 }7 m. S" P4 r: y
////下面不需改变////////////& D. a  p  a- n2 R/ `9 s

* [( S9 H' M& X& w4 P: _var copyspeed=marqueespeed
2 p6 `: ]) b9 f7 V" v! K: nvar pausespeed=(pauseit==0)? copyspeed: 0
6 \1 j  C! t$ p: rvar iedom=document.all||document.getElementById
) ^. ^" A8 c: z! f4 |7 G2 W% Gif (iedom)
3 T4 D/ Y$ R+ U4 idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ ~- s. @( L& F
var actualwidth=''
5 f/ k0 ]" b; f0 J1 ovar cross_marquee, ns_marquee
/ N/ f* l7 K; b! p# N
* S* j1 V  B8 u1 n$ C2 k. Sfunction populate(){
$ H1 @) _$ l& ?4 qif (iedom){0 T) f) i* B3 R1 }: ^
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- o# I) R3 ?3 X6 ^) d. i6 a
cross_marquee.style.left=marqueewidth+8
/ P+ `6 }  ~: kcross_marquee.innerHTML=marqueecontent- m7 c" K- R6 P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- E) v9 r2 r5 Y8 g3 M3 p% }; q; E6 J}
: _6 G; t/ y1 \4 _else if (document.layers){# Q0 [* n% H3 v9 m( |$ A( j2 P0 X
ns_marquee=document.ns_marquee.document.ns_marquee2
) l! M) q& j( }) z/ Q7 ^ns_marquee.left=marqueewidth+8
& w. J. T3 v' I  N6 Kns_marquee.document.write(marqueecontent); D/ M% |$ o4 H( J/ g  V( x( X
ns_marquee.document.close()" _( \, ?) w+ ?
actualwidth=ns_marquee.document.width4 ?* ^9 Y7 L1 {7 |) x
}% I6 O2 m; b' j
lefttime=setInterval("scrollmarquee()",20)8 J3 x0 k) L" _4 M  F
}+ ~" o$ W1 X! o& c' H& D
window.onload=populate
" b! D. a7 s6 X8 a% ^% x  H  M
/ `* s* k. z8 qfunction scrollmarquee(){' Y0 o3 @) M  H
if (iedom){
" }8 K+ H4 d. |% y; x2 Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( m2 L0 L' f7 G/ `+ R$ Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, Y  h. N( [4 O' Eelse
; K3 o6 Z# i* D" d* h* ]2 f- `# Across_marquee.style.left=marqueewidth+8
8 h5 Y  H6 F' T8 W4 s% N: J2 x
}
1 R/ [- T7 y7 R  ]  d- X  oelse if (document.layers){
  M+ L+ H2 L2 U0 R8 [% Vif (ns_marquee.left>(actualwidth*(-1)+8))3 s( H, o6 M( q' B
ns_marquee.left-=copyspeed
8 o7 a1 O2 Q) ?  Y$ F; o5 delse
# c& D$ _6 ]5 J; Q. z& O+ pns_marquee.left=marqueewidth+83 u5 Y; w  ?1 Y# d5 F
}
! |( _/ w0 X- e' j0 h% R, d# H}
: N4 T; b6 n/ h4 Z- p+ U  u. W, e$ S2 P/ w$ O, |& Q( J0 |3 m2 J
if (iedom||document.layers){0 o7 ^2 w  j! ?- U, C! s
with (document){
. G$ f6 P$ _6 o- j+ {document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" G) _0 e7 V3 J0 l( Yif (iedom){
* U' q; H9 I7 H# A3 d1 A/ h* Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 c( X* E/ x0 @( q) x( ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 m/ L/ R7 ]. s. T$ ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 ?# y8 t  z' Z/ ?7 H/ Pwrite('</div>')
' J3 q  c7 A2 w5 n}5 T% `; r5 n+ ?! `6 r
else if (document.layers){
: o& d8 a0 g/ [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 W& D# G- P  U# T* |9 Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 n( J0 i, b, M6 G  P
write('</ilayer>')
+ b0 r; e0 `: c2 D$ ^+ A* U}; M# V: e% P. _0 }7 C' r
document.write('</td></table>')! G. u! o2 q5 _# t4 P0 h. }
}
0 ~9 F5 M/ c3 F}6 S' {: h) w; b- G5 D, h8 W, E; s" s0 @
</script>

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