|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度! W" ?2 Y7 R' a4 k4 S# E$ `
var marqueewidth=300& Z! d( U2 Q2 i+ I$ o
//高度
9 p0 U. f/ d6 p1 r- bvar marqueeheight=25+ @0 j" z3 A8 i0 G: B
//速度(1-10)
/ q* P ?4 \8 H3 ~var marqueespeed=3
% ?1 g8 a+ T9 {( Q) k4 ~9 _6 N//背景颜色
8 F! B6 i4 L% |var marqueebgcolor="#FFFFFF"/ Z! ~! e! _, l5 Q: z
//是否能暂停 (0=no. 1=yes)?
. U# M& ~; Y& W5 L* W. o4 M7 V/ lvar pauseit=1% j9 Q$ f, Q5 M2 y
3 K3 Z, i: O4 z% j9 H# _4 b
//修改显示内容
6 R" B+ J* N6 k7 [ T- Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 ^0 M+ J* G# b
) x8 @& r- }! ^2 P
2 V' Q1 l" e/ Q
////下面不需改变////////////
# x& V/ h) I; d; s9 f* ?# W5 ]/ ^( Q% k6 v5 o
var copyspeed=marqueespeed
* u/ g; K' C) e4 q$ rvar pausespeed=(pauseit==0)? copyspeed: 02 s& O+ B7 `/ [9 t$ j" t
var iedom=document.all||document.getElementById4 E2 T# d( k. |" H; i( p: o# M8 b
if (iedom); o2 v, g5 C$ c3 k. [* c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( r7 }8 w2 t: y6 e: d
var actualwidth='') \: p. \' |! [! C* U
var cross_marquee, ns_marquee
+ i1 K9 I5 u3 l
1 @: v/ d; {2 p5 y ^, wfunction populate(){7 g3 j2 d+ F) D) w" q
if (iedom){& i0 g: @1 c% B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: c N" z- D, L' u" Q5 pcross_marquee.style.left=marqueewidth+89 G# E4 E! n0 \/ U1 j8 t
cross_marquee.innerHTML=marqueecontent$ I c. i: b% d2 U+ h( h& p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 o3 b3 l9 ?; S9 L; z9 I- M
}6 Q0 M3 n/ p: W/ q
else if (document.layers){/ T6 W7 Y- J; V/ v3 `. S7 D
ns_marquee=document.ns_marquee.document.ns_marquee2 K4 R8 I' [8 r% ^3 n
ns_marquee.left=marqueewidth+8# l: ]* _: ?0 p& x
ns_marquee.document.write(marqueecontent)
8 b' B( y& {0 p3 d* ^7 p/ Nns_marquee.document.close()
# k6 ^7 s- z9 ]* k6 S+ sactualwidth=ns_marquee.document.width
) @) F7 } I: p, D* q& ]}
/ N0 ?$ R/ O& f$ ?lefttime=setInterval("scrollmarquee()",20)) t& p3 g, u/ @/ _
}
8 Z8 A! D6 ~- K1 k/ `* i' `8 cwindow.onload=populate
7 o* X/ V, I: S+ P) w* W; ?6 v2 d
function scrollmarquee(){. Y9 c- t/ c5 W5 T8 L
if (iedom){
& |6 }4 h$ k( F6 F6 D0 [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 ~4 E) {& o: R, t- Y* s( ~1 @$ i6 U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! G$ k1 R! ]* v5 Celse+ H3 z2 [5 r7 k" m+ c; K
cross_marquee.style.left=marqueewidth+8/ ^* g2 S7 G/ [' j( ] ~- |: @& `
; ^# k: j* F( B}' o- {0 ]/ }$ \
else if (document.layers){* e2 ?! h u8 J! F% m
if (ns_marquee.left>(actualwidth*(-1)+8))" y# E' J) m; e1 U* a
ns_marquee.left-=copyspeed0 T5 U7 A5 M5 h8 T" p [
else& E2 C% e; M! u1 `
ns_marquee.left=marqueewidth+8
- C) _9 K; J2 [ B/ ~}
) w% c+ {* W5 u( a0 C9 Q1 M" G}' O k0 d% ?! d! _" I
- H: |5 A4 t: T5 r# s1 m+ nif (iedom||document.layers){
) b' r b' I3 _6 l0 @. R2 Owith (document){, b0 ?! M6 x8 Z+ h" r. `& Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* _5 J# H! w0 P, T) Bif (iedom){; x5 y" Q; P Q4 a0 J: p: u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) R# D& o' _$ Y6 B5 l* Z+ l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* r& a" x& d1 F9 t7 A d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' w/ f5 L* {" ^+ I' t y3 G
write('</div>')
5 L' W) R+ T$ K( k9 a} z: u8 C; a* q3 C* {7 w
else if (document.layers){
5 W+ H/ E7 X- Q4 W+ _4 r& twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 D4 V' k8 p; Z9 p6 w0 u
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( H7 u6 n& ~4 s+ @write('</ilayer>'): n7 [2 C: ?1 H
}& L! c$ J% _4 V b9 \% G6 J
document.write('</td></table>')
. J; \ ^ G ?2 T}$ `/ d; ?+ V4 S# {
}
2 S, l3 t% U ]; G5 _9 b3 L/ I+ V</script> |
|