返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( K* t7 k* e/ t( Kvar marqueewidth=3005 B* J6 M+ q9 u* v
//高度
& J+ S, }( o& w; w4 a) v6 J1 ?- d, u9 xvar marqueeheight=25: k+ f; q. {1 D9 @; d' U! f  C
//速度(1-10)! {3 [2 ~$ {. h4 |. ?, T) r: H
var marqueespeed=35 ], U2 r4 a! }: |. R
//背景颜色, ~, B) O+ _: S5 G
var marqueebgcolor="#FFFFFF"
% {) y7 ]8 S) o! h8 [//是否能暂停 (0=no. 1=yes)?
. b9 c% D- a! jvar pauseit=1
. a& X$ ^' B$ A: M5 x! V4 |
9 s. {5 C0 r; _: o0 i) ?/ \7 X* v- P//修改显示内容
, G8 p0 A' F7 n& |# i; S+ Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! I% `/ R, g4 ]- T/ \( e1 o

0 M6 D; e5 I3 C
& W9 g, n" I- P* ^3 C////下面不需改变////////////
# O; R: x5 a: L
+ g  Q! |% J, |) D# E& kvar copyspeed=marqueespeed/ L5 V$ P! P# Y& s9 V& Q( {$ ^5 h
var pausespeed=(pauseit==0)? copyspeed: 0: Q0 G4 j3 g. Q" @: N
var iedom=document.all||document.getElementById
1 l6 `" B( Q9 d6 x+ r* qif (iedom)
' e3 O! g/ v1 \" D- m6 Y- W6 P; `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ e5 t0 ?0 w$ K/ n* c+ {var actualwidth=''
2 p, ~, A; s" e; Q0 w5 zvar cross_marquee, ns_marquee+ O( h2 u4 e- ^! N) y: i
2 H( p% _0 j* X8 h* l
function populate(){% z' r7 o% C7 b2 Y6 E& E
if (iedom){
7 p6 r" ?2 k; Q: R, Across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: X( `" G" `$ ]" o9 across_marquee.style.left=marqueewidth+87 j3 a/ i% C* {. b  Q, v9 g
cross_marquee.innerHTML=marqueecontent
: p6 V1 S5 K, ?% J0 c0 V# kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' B3 ]( i+ ~' t( L/ s4 I) J
}
% p/ f; ?9 v% W, velse if (document.layers){
/ u3 {& T' G5 H  N7 M% V! Pns_marquee=document.ns_marquee.document.ns_marquee2
; O( K/ K1 x9 [3 j% F: lns_marquee.left=marqueewidth+8. x+ d' ]- y0 @) g* G) v
ns_marquee.document.write(marqueecontent)
# H  A9 F& N5 y. |( j8 J7 @' R8 }ns_marquee.document.close()- w" W& I, y/ P8 l0 p2 ^: k7 p
actualwidth=ns_marquee.document.width3 E4 J( U! {. Q) g1 \' y
}
  N# g4 C. d" U/ Clefttime=setInterval("scrollmarquee()",20)
4 A" T# d( ^  a- C- o}
$ ?7 A1 q3 @( ~! \window.onload=populate
) @0 y' u' G9 b1 ?  y8 M8 l( X3 Z( X2 ]+ A/ i9 Y7 U
function scrollmarquee(){! e% ]8 z2 V; E& H% Z0 C5 L: S& ~9 ]
if (iedom){
) A) D+ k4 L0 F, u$ j( Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 R0 ?# M$ B% J: k$ p/ y: a5 n. q: ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ q% ]" V3 q3 Pelse& W, N; n  s  ^4 T
cross_marquee.style.left=marqueewidth+8
; s- b. X+ C* v# v' ~1 ]2 k1 k6 \: E: e6 w# E. @* i+ `" ^% \
}9 S$ T+ g6 }" i
else if (document.layers){+ \. q, W) l" t) R# ~2 U
if (ns_marquee.left>(actualwidth*(-1)+8))
  Y2 X" w; D$ h6 r( E! rns_marquee.left-=copyspeed3 [4 W0 I6 ~6 s2 P# s+ v5 b4 c
else, z. _: _& v- @, T$ v9 b. \
ns_marquee.left=marqueewidth+8. X3 ^- `3 c4 W% }$ @1 A
}
4 z* w* k* D. s0 M" ]* i0 g, E7 N}1 u* O! S/ K$ B/ u9 i( [1 @
: J8 Y2 I! K1 o; q2 q8 \, n
if (iedom||document.layers){2 `& ?& @" g8 ^2 Q$ G
with (document){  F& ]! {9 [' s4 u0 v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- v" q' W# m  L4 wif (iedom){
  l& v  W6 n, D& H* kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& `& ^7 F7 M2 H! B' S- c4 k
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( m5 `' T/ M8 A( T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- T: M( ^) ~& j( A; H: p& S7 Xwrite('</div>')8 I0 ?/ \; G9 U  n6 X
}3 x& m4 A8 w% ~0 l8 j" ~
else if (document.layers){
" l2 A% V( Q9 n# r( _  nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 W; n$ Y5 F( }% R! k( P) w$ Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! `4 z- a: J) s/ f% R
write('</ilayer>')3 z( y' v, S1 y' n
}8 V/ ^7 p/ R/ o) t+ p. e" g
document.write('</td></table>')% M, V, F5 {" F: j  @4 G. s8 _
}
  u9 M1 P8 z- F8 |: w* K& K}
1 Y- R8 Y' J1 h% k</script>

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