返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 k% x/ U3 K3 R9 I  ovar marqueewidth=300- ]" f! h2 d' W% S
//高度
( i" K! J9 |. g. evar marqueeheight=25
% ~" B' t2 o7 ^0 ^0 r//速度(1-10)
3 R7 S+ S* J6 Dvar marqueespeed=3
2 |9 o- P! I$ L//背景颜色
1 H: S1 ~- c- C" O; c# K0 yvar marqueebgcolor="#FFFFFF"  m6 i& ^$ A; ?5 C' ~
//是否能暂停 (0=no. 1=yes)?  r; |- w$ G' ~& a; |
var pauseit=1
& n; R/ s$ s- f7 z" M& F5 d6 P6 [" {# Q: ^% ^1 `/ Z9 G5 S/ ~
//修改显示内容
5 C5 m9 B! I% W4 U0 I$ R0 d$ Wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& U. w  b$ y" z: S2 E% c2 H  n  @/ v6 j9 q, p$ ?
4 j5 B% J/ I2 {% K, n3 x# a
////下面不需改变////////////( q4 W9 w0 u( E! ~2 c

* O. f( j) U7 R' w, O: o3 vvar copyspeed=marqueespeed( y' }2 k% ?* ?- A2 E! R) q1 E
var pausespeed=(pauseit==0)? copyspeed: 0% j0 I1 Z' ]6 v3 Z0 s$ ]- h
var iedom=document.all||document.getElementById2 I) ]% \( t, d% Q# B
if (iedom)1 g5 m5 ~3 i: V1 v7 l" E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, b# W9 A5 w2 lvar actualwidth=''
# K0 k: T/ o5 K! g# a; mvar cross_marquee, ns_marquee
$ x9 }/ Z7 @( q9 f# \9 I  }6 L
) F/ O( U4 U4 _function populate(){8 D" n% p) _- I- S, T
if (iedom){
- w6 D1 v2 z6 f3 w' [1 c- ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 s- O* V- [! j' Q0 m
cross_marquee.style.left=marqueewidth+8) t  A7 ^6 [7 F* v9 i
cross_marquee.innerHTML=marqueecontent- U; ?4 D2 O! |5 u( \, T3 C; T* o
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 A# p* w" J& I- Q
}5 e# C- Q8 S1 ?- ?
else if (document.layers){
: t, r# P2 h* Nns_marquee=document.ns_marquee.document.ns_marquee21 m$ ?: g( ~  \4 P2 m( V
ns_marquee.left=marqueewidth+89 k) H1 l" ?( t5 E, D+ a0 n
ns_marquee.document.write(marqueecontent)+ E  H" T5 B; _! ?
ns_marquee.document.close()
4 G% v) R* k  y, Eactualwidth=ns_marquee.document.width- c# G$ {5 t# J6 |
}
  b! t  I# M) j% Slefttime=setInterval("scrollmarquee()",20); }  d- w# I( l
}
- H- X  U/ s5 R% L5 i: d4 B9 xwindow.onload=populate
5 y% |; Y: e$ s- n% w+ C( H* E* o3 c. X/ r
function scrollmarquee(){. \' h3 n  m, P9 e+ c
if (iedom){% T1 N$ R# g4 `  e+ `- i- D* L6 ^
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 x: {& S) ~; G5 i9 |0 P) M
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 e; J( Q( t0 M( }, L
else
2 d% p5 a* f5 c! R; j8 Vcross_marquee.style.left=marqueewidth+8
4 N( @& I9 b: C0 e- f( Q
2 a7 g1 J  a$ E) U4 s( e/ l}; n/ p9 z0 H# z1 T7 K0 K
else if (document.layers){) O  f6 E  G/ g$ y1 s
if (ns_marquee.left>(actualwidth*(-1)+8))* c; \8 H+ N  l
ns_marquee.left-=copyspeed
8 ~0 Q. }) `% E+ d( g, relse2 C" J9 v+ `4 ?5 q) y0 ^/ L5 Y
ns_marquee.left=marqueewidth+8* J& ]3 l/ N5 O- P- T, f; a
}
; o" D7 F  G: Y( M- Z6 N) w}3 `- B9 s* K% G( K/ `7 J8 v# [  Y

4 p8 h+ m  [6 j' b9 Oif (iedom||document.layers){1 P$ j+ b9 q# a& q( @: |5 j' t
with (document){
/ }/ a  l0 h. [  e3 D/ x; O+ rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# F# U$ u- Z( y" pif (iedom){: E; V6 \: Y$ N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  \% X- I, B/ J- C% U
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( I$ z& d, }" N/ P/ ]/ ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 ]. N; `% w# w$ T1 B
write('</div>')
  h) R+ q9 ?2 B}
2 N, K- U! Q6 |  delse if (document.layers){" e4 `% l9 G3 E/ a
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 r$ a+ Q/ G: G1 `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 H, J& |8 M9 J7 o; W
write('</ilayer>')! _5 }# v7 z* ~& X. Z# y$ C
}; j6 e$ @' Y+ O1 U% n
document.write('</td></table>')
- g( |5 U- T# [% E) m7 Q& N( B! b}! b' m* l$ U7 z% E: T
}- ?$ m, b9 }$ _. c+ R  j
</script>

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