返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 C, h2 P% w- w3 L1 T: avar marqueewidth=300
! f1 y1 L- t1 T$ B! N//高度: c2 X7 e2 \: v5 B& b( M$ t; |- _
var marqueeheight=25
% n5 f) ?! }; i6 w: n- T//速度(1-10)7 i9 p5 c2 K4 x/ Y
var marqueespeed=3
+ J& c1 r  k8 ^//背景颜色
+ @4 m. g) n5 L% N; Y* k7 mvar marqueebgcolor="#FFFFFF"& D; s  e3 q, V
//是否能暂停 (0=no. 1=yes)?
7 ~3 w, @/ \: ]! S: t0 yvar pauseit=1
7 t+ r- S# U; n8 t0 ^6 _! C
' D! }* s, j' Z( b, {, c# g" L//修改显示内容. u1 q6 f7 s$ Q0 e2 y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 Y  P+ ], |% f2 ?
# e! |& m7 X  L& D

: [2 I6 o( R( u////下面不需改变////////////, b- A$ |; c8 ~$ d! j/ f2 F
$ t8 l& Q5 L: [4 T* l* x
var copyspeed=marqueespeed
  }6 s7 f" i7 Cvar pausespeed=(pauseit==0)? copyspeed: 09 G+ X8 ]: ]1 i% p* C
var iedom=document.all||document.getElementById: E5 Z" T) h. v' ~3 }7 o& z
if (iedom)7 u1 }: a( o8 |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; T0 n, ^7 H# s- e& kvar actualwidth=''
6 e4 d2 D- a4 n; s3 V5 n1 l0 Bvar cross_marquee, ns_marquee
& d% b, R2 J+ y" v  I+ P5 T. V5 m3 k
# P: [5 O  s7 i) k' Nfunction populate(){3 ?+ O3 G6 m" m9 A0 r
if (iedom){
. n6 o& ~# d2 l- f' s! `4 zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 `# y+ i4 b' Z  E
cross_marquee.style.left=marqueewidth+8
+ S8 H$ L& T3 Z0 zcross_marquee.innerHTML=marqueecontent
2 X) H, e, `+ _5 Q$ qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( ^: V. {+ R' |}4 t* F8 P7 u% F
else if (document.layers){# C" B; g6 h+ y: {$ l" x3 x+ ^0 y" S
ns_marquee=document.ns_marquee.document.ns_marquee2- ~/ K  o$ F8 T- T: o1 y
ns_marquee.left=marqueewidth+84 J0 l3 D! L3 @# B5 @
ns_marquee.document.write(marqueecontent)- u" F) q2 I; M" H
ns_marquee.document.close()9 Q& ^7 J; n2 v& D* Q$ C& h
actualwidth=ns_marquee.document.width; A; k( T1 H9 r, G% ?  r
}, O6 T* N6 {. |' _" X$ ^
lefttime=setInterval("scrollmarquee()",20)
* ?1 z1 s' U$ F}
7 W/ _: l6 M( G* f$ d/ ?window.onload=populate
' r# f9 k& G; f- a5 @* p+ i2 A
& _  \/ r% j) Q* o& d1 Hfunction scrollmarquee(){4 ]; ?/ ?7 B) q( \! t' m6 k) L
if (iedom){
- q, y7 q& K' T) w& r3 S4 H2 z8 Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 B4 c; R" A. o  O/ Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 U! v/ N5 t) ]else
5 |7 w% L6 [+ k3 h6 Hcross_marquee.style.left=marqueewidth+8$ ^  e. K4 {! E2 B) W: r

, b9 ]" o7 Z8 C}
3 J6 s  [# A/ s! q- ]else if (document.layers){
& V, R& a* a, i& [% w* g6 d' \. Bif (ns_marquee.left>(actualwidth*(-1)+8))
. ]7 ~7 }, {% Z1 E$ Mns_marquee.left-=copyspeed
- l, V5 J  N% g7 C# e, \1 o; v- p. welse1 \! S& _8 i- B3 A% ?/ R+ Z
ns_marquee.left=marqueewidth+8
! X, O2 j# \5 D9 P! k}. G. @9 f/ z1 C& t
}. t6 `+ o6 i$ v. B3 w

4 p; r+ h. R6 E! K- Dif (iedom||document.layers){1 P! z9 e1 ^% T. H
with (document){- }6 n# n. V1 u7 Q  U2 @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 d7 M* [( j1 w( w
if (iedom){
+ e, H) B/ c  X) M/ t' Dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 D: u9 u* Q" m5 g9 f7 ~8 a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. v' Y! ~9 [6 P$ m0 awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" O" X' k4 a+ c/ dwrite('</div>')1 U) u) j  L( @4 ]+ {8 U& J
}
5 E$ B) R/ b8 L8 celse if (document.layers){
  ~2 m3 K$ ?" k/ {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( M' ?& v- M; pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 ^0 v) W/ v% C0 v
write('</ilayer>')
- c2 n) @3 s/ M& {2 q}
& Q! v% G+ W! b& ^" ~9 Tdocument.write('</td></table>')
' H9 m- {2 h9 ?5 }" b}
% D8 p6 K8 D4 c, V8 @0 n}
# D7 N, D1 q* \2 T! e2 U4 c</script>

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