返回列表 发帖

网页之跑马灯文字特效

//修改宽度! W3 |5 T1 W! K5 W" O7 L
var marqueewidth=3005 ]- o- c1 y5 b9 Z
//高度. q$ w, Y/ R; W
var marqueeheight=25
  I5 l" ]. e/ E; u  J, t//速度(1-10)
8 J2 O* h; C/ J) [var marqueespeed=3
; \. p3 D$ ~2 P* B* z* j. O2 ~//背景颜色4 S3 {9 h0 |& e$ ~% }4 H- G
var marqueebgcolor="#FFFFFF". v0 D2 ~  P* A8 l- i* y8 R
//是否能暂停 (0=no. 1=yes)?
+ M! M( m2 g6 H9 rvar pauseit=1
1 D! b5 v( Z* m1 `& q) q2 H* T1 s6 Y  ]5 W$ c# v
//修改显示内容
1 K4 c# D0 H, l3 f  Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 l+ I3 b( R# X! v  ~8 E; k
2 [2 f$ ~+ ]5 z2 v8 W% _' n  l, A( _7 L. v
////下面不需改变////////////
" ?/ h5 g0 \- P6 N5 h: |1 v/ ^$ U/ z- R
: [% C# |9 ]% C% Q, Xvar copyspeed=marqueespeed9 F  t2 B" w  l2 u% `# [3 T* D
var pausespeed=(pauseit==0)? copyspeed: 0
  {% s* ?. W. ?( ?8 y5 i2 d' Cvar iedom=document.all||document.getElementById
0 v* i, D. S* {) \if (iedom)
, v! @$ Q, ^4 Z( Z/ q8 xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ T' V9 z1 \1 W6 w# Lvar actualwidth=''
) D# e: N- f/ o+ vvar cross_marquee, ns_marquee
" y: Q1 r0 f) q8 q  j7 W( T  R3 |; U0 j( P
function populate(){
& b& J% B! E& m; T9 gif (iedom){# G" ^. [. D/ P6 K' m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. W* T% ]# z( r, n5 _
cross_marquee.style.left=marqueewidth+8
2 R/ d5 W( A, Y( Z" |cross_marquee.innerHTML=marqueecontent
7 ~5 E+ W4 ~/ ?* Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( K1 S- B8 h; Z: |- S  |  a
}1 |9 f; d* E+ [* R) H( ~- A
else if (document.layers){+ w0 {% V4 ?9 R* n! S
ns_marquee=document.ns_marquee.document.ns_marquee2& J& @' G* Z7 e) h+ h; }9 U
ns_marquee.left=marqueewidth+8! ~" L" c. g' e2 }. d
ns_marquee.document.write(marqueecontent)
1 |  o5 ]" t* {# Zns_marquee.document.close()! `. v9 Y5 h3 `# y- G, G6 g
actualwidth=ns_marquee.document.width; D9 [# A: @  t5 J; a
}
$ e/ Z3 ]% {! I8 _4 y$ H5 J+ alefttime=setInterval("scrollmarquee()",20)
8 H- u1 K, |. _1 M6 ~}
/ {$ T5 E" r! E8 e1 ewindow.onload=populate8 |5 I9 m/ C( s9 ?. T8 R
  B6 ]% p3 {1 I/ m
function scrollmarquee(){. r- J3 {* w9 K3 t
if (iedom){
- j" F& ?; O2 K6 Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  Q3 E9 y/ C8 A) o: Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( j" }# R% i5 [else) v7 Q# q+ Q9 T3 z5 u) e
cross_marquee.style.left=marqueewidth+8
9 I3 c# j% p# `; E4 {( _, W/ w4 D. L" \9 P  M$ `5 y6 x
}/ d5 i' g9 I$ ^4 |0 f* [. {
else if (document.layers){
) `* C/ q1 a" P# V  f+ H) Hif (ns_marquee.left>(actualwidth*(-1)+8))
5 }; m+ n, s) k  Y* O  nns_marquee.left-=copyspeed' p  W1 e+ k* P: |
else. F. s6 B6 N9 h
ns_marquee.left=marqueewidth+81 o( n; e: }3 E/ i, P' b  u
}
$ |0 ]! e! R! M1 u: i8 P: h}
0 S. Y2 X& {/ J  Z$ x2 c9 ^# C
1 O' V& h) K% uif (iedom||document.layers){
0 B; n1 p1 \2 E( swith (document){  @, h/ c4 n* i* h0 `
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ f- D' y+ ^. ^2 D: g
if (iedom){& f( ?# _/ x9 v  K# ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 O/ `$ R: b" w" Q- o
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# b+ l" L9 @7 Gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: l! r* Y  h1 {write('</div>')
9 [# u# f. g) g4 ]' ~# D}+ E  ?  l' u; {. B: d- h7 h
else if (document.layers){5 J3 R$ [! A* C- g  F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 b1 a1 Q- o: ?% }( f5 ?) g8 z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 [# A# H; g4 n5 `" M/ C( x* H( z# W
write('</ilayer>')* u  Q3 p" }; j& ~2 j1 Q' i
}8 G5 C# H2 |' w+ }5 R. W
document.write('</td></table>')2 R0 y7 u0 C0 l5 M' M4 Z2 D7 A
}' u' B3 E2 B" U% c' E  d8 ]# H
}7 L$ K+ p6 l6 A% o, a
</script>

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