返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* f* f/ h: @2 Ivar marqueewidth=300
1 j5 h1 k' Z2 B- j% ]% g2 M//高度
( t( ]6 M- H! }9 D. hvar marqueeheight=25
0 f' f  q( O/ w8 p4 F//速度(1-10)& u/ e9 ^5 V  v9 d+ a6 M
var marqueespeed=3. y! N5 ^5 h0 H
//背景颜色
0 W8 A) }+ @$ H7 {: Q/ Pvar marqueebgcolor="#FFFFFF"
4 u# z+ `4 E5 E# F! w1 w- r//是否能暂停 (0=no. 1=yes)?
) W8 K6 D- g) z3 q! d& Lvar pauseit=1
, i5 O  {) s# n6 ~* m  ?/ S3 l4 f( L/ w% |" p* y1 j, {
//修改显示内容
- ~* N8 \! c- C! Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 m  I; I3 a, ]; [+ |

  \6 v( K- ^- m# T
6 j0 g0 H4 g$ U2 ~# v2 s/ a* x////下面不需改变////////////+ @1 z; _' j3 t4 u7 i

) ?9 `; i5 }3 r7 Fvar copyspeed=marqueespeed7 p) _5 ]. _/ |  W' ?. t
var pausespeed=(pauseit==0)? copyspeed: 0
( F5 R. H  l( U/ M- V0 Dvar iedom=document.all||document.getElementById
% o% p' D$ P6 ~* \  cif (iedom)* Y* X- `4 N+ r; v- [# O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* a7 {: s3 ?, D/ L
var actualwidth=''# y7 }7 G) ~% W! t/ [
var cross_marquee, ns_marquee: H, k% O0 `, t$ n7 L5 x
* L2 k( a5 d: o6 Z. P$ t$ N
function populate(){# H" P+ ~& i) Q# J
if (iedom){1 a- B) O2 e; J0 b0 ]% U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; a) Q! l5 \0 ^6 \
cross_marquee.style.left=marqueewidth+8/ @$ C+ z, S. I+ |
cross_marquee.innerHTML=marqueecontent0 u- F3 ^/ j& C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ E( E" O. n( \# g}& e! U8 [4 Z1 `+ V1 `7 l
else if (document.layers){' l: k, x( x+ q& s# h7 J
ns_marquee=document.ns_marquee.document.ns_marquee2
& j; j: ^! W8 v$ p% D8 Ins_marquee.left=marqueewidth+8
, T0 H) `5 T' \/ ^- G, M  ^' [( sns_marquee.document.write(marqueecontent)+ W4 @' [+ b* l" p
ns_marquee.document.close()
  x1 ^9 y7 B+ _& H7 Mactualwidth=ns_marquee.document.width
, l5 [6 U  u0 c8 Y* I7 P}
& G6 G+ D3 X5 Z; `2 N) `lefttime=setInterval("scrollmarquee()",20)3 H* N0 X% h2 n" o
}
* Y+ C  o! s; g0 [6 ~% ]/ }window.onload=populate3 |' G9 Q" s" s% W1 z/ b

/ ?# d" ^( S3 t! pfunction scrollmarquee(){2 U4 |; p& _7 @2 q9 f
if (iedom){2 j$ r6 e' Q1 Q! l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- e/ e6 r3 a. H& Z( J3 j4 V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! w  g* y6 \5 melse
# \0 i1 Y% Y; {8 D9 Vcross_marquee.style.left=marqueewidth+82 G9 v, K0 }3 ~1 b

! A. E  y6 L$ Z# [7 \}
* Z; Y& d: B! W+ F( T2 N% |$ G2 eelse if (document.layers){) w  J# i$ h. y2 |3 q/ Z
if (ns_marquee.left>(actualwidth*(-1)+8))
" j8 G! y) q7 e  Wns_marquee.left-=copyspeed
* X! d9 O( N* w' t9 C4 N% Uelse
4 O) D# b- N. Gns_marquee.left=marqueewidth+8
9 F" I+ Q. D# B6 m}2 X! v$ _+ |2 L6 p% ?
}- b. n! t6 j( P; }, q

- X9 V: [0 ^% j3 A+ G1 Tif (iedom||document.layers){8 s7 x' R; x, N4 Z( H6 }# n- X$ W
with (document){. m/ R: T3 h1 p! @' G  Z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 p/ U' {% F+ c4 m( i) `, `6 Tif (iedom){! \- C5 r  e+ D+ i, u5 W1 X+ \
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( E, C9 X" h. n! R5 a/ k$ ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ C$ d9 ^1 M% Q$ @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 v) l" O9 G; A) a0 G$ w0 lwrite('</div>')% n) X! V$ ~% c( j+ o$ I  K
}
5 y) g  h/ ?4 f2 T! n$ q2 z* telse if (document.layers){6 O4 ?2 a( }& g$ o6 c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) x# t- ^9 P& ]( s7 P- X: n4 E7 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 D; B2 a( E  w& i# |write('</ilayer>'), z; {" _# q: O0 p% O% [+ n8 h7 w
}
. ?2 U2 P$ ?  Mdocument.write('</td></table>')
8 t* Y+ Z* h' X" Y, S& z# y% I}; k. D1 R+ ^6 C
}$ o/ q* }* m/ N4 K7 x4 B
</script>

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