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

|
网页之跑马灯文字特效
//修改宽度
7 [. T9 v2 p0 J1 z' j9 Xvar marqueewidth=300
! a3 M% I, l& K: Y//高度5 v/ t( g7 b9 J8 g
var marqueeheight=25* u$ g" s. l: }4 n0 I _
//速度(1-10)
4 M: U* \8 I) k; C; i* Rvar marqueespeed=3% V& s$ z% y" [$ D
//背景颜色' l4 h; e4 V( n, d6 Q0 _
var marqueebgcolor="#FFFFFF"/ S8 X3 E0 T" V+ a
//是否能暂停 (0=no. 1=yes)?
' z0 D0 t5 D3 pvar pauseit=1
' [% ~: m' [0 X# e( I$ T" Z0 ]* v+ c" Q
//修改显示内容
0 C& }0 U% S8 R: l( D# xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% D( D v1 _- Y. Y/ }
: q/ e7 ^1 ?6 p2 Z
% y. }6 a8 t, Y+ Q. u% Y T////下面不需改变////////////
8 ?4 E0 L; L) k+ T: [3 E. V) a3 J3 r3 \; n
var copyspeed=marqueespeed
% |, Z% W3 ]# f. |9 cvar pausespeed=(pauseit==0)? copyspeed: 0
, p, h" H- h' z" dvar iedom=document.all||document.getElementById$ x. _. R) u* d( n$ I. I! k
if (iedom)
* p3 c& N F2 r' y/ x: xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 n9 @ ?/ {' a* y! F9 S6 ?
var actualwidth=''
: y( Q4 @. F! e5 P' p' dvar cross_marquee, ns_marquee) [9 t. ]& ?9 X7 u3 I5 Q( T5 q
' E! ~" t# l" Xfunction populate(){
6 D$ j7 ]: q$ B4 |7 e1 v7 Bif (iedom){# u& q9 Z: H7 q2 L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ B9 q# j3 K( L8 b; lcross_marquee.style.left=marqueewidth+85 V- y: ^7 K# n
cross_marquee.innerHTML=marqueecontent
0 t0 s# z5 `$ n) U* F9 Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& G% j2 _+ P0 s! S/ d, p L" @}! |2 {( ~3 s) j
else if (document.layers){% O! _: A- \* r
ns_marquee=document.ns_marquee.document.ns_marquee2
5 ]3 l; E {" u( ]8 U5 W! f/ bns_marquee.left=marqueewidth+8
7 A; Z* b7 k& ]ns_marquee.document.write(marqueecontent)( B% y; B5 ?5 Y6 d3 B X4 r
ns_marquee.document.close(). ], Y) ~4 Q% J9 b
actualwidth=ns_marquee.document.width9 @' g f, G7 ^: b# F
}
9 Q) k$ c+ a( d7 H$ {) E" Alefttime=setInterval("scrollmarquee()",20)
5 F7 h& }* e8 ~( o' f" o}
. m8 T* h& H. \; _window.onload=populate
v! Y$ L2 F( U, v3 n% e0 g& s
3 E |1 E% h# Qfunction scrollmarquee(){7 S4 K6 _- v4 {9 \
if (iedom){
% d% [$ E8 g1 l2 z/ g0 A/ iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 d" | e. S0 t8 C( ]1 }+ Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: k* E' L5 ]8 \ a; I& b
else2 m3 B% y. _- p2 h) Y5 C
cross_marquee.style.left=marqueewidth+8
' C; A8 W' h% U% i0 Y1 |) u" m( }
7 i% |7 I1 C& V9 s2 u ~}
9 m0 h" b/ A) Y0 [7 {& D8 Zelse if (document.layers){4 ?9 [& d; @# h& B
if (ns_marquee.left>(actualwidth*(-1)+8))
3 r! Y. m' @5 Q- q6 T ?! A, fns_marquee.left-=copyspeed
4 L" y. j1 w% n) Q& delse
. H$ H5 ~: Q5 Q B3 a2 c$ hns_marquee.left=marqueewidth+8 @, f& N" T. G6 E
}
& W/ c1 m2 m6 X" J: m' Q5 r+ ~}
/ w% x# P! y; h* w5 H0 n$ \
& Q7 F9 e4 O5 _- e2 ^9 U0 a7 k6 qif (iedom||document.layers){
% o5 a6 C' y0 twith (document){! c3 q7 {* s3 F7 }& Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% I" K( o* w1 V* i) j+ o, J
if (iedom){
6 k& ~( ^ D- F, R+ J' p( swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): ?( I3 \3 m0 Q" R( c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& }& [# `, o2 B4 `' v& j% Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 \6 i6 B: a9 t4 g Z3 v5 _' Vwrite('</div>')$ o: T2 V# t5 a; r7 k
}
E: w& V4 I( Oelse if (document.layers){& Z; \ `5 a* S! e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 s" K8 m( L0 x7 Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' X$ ^. [" N2 G
write('</ilayer>')* }; q% S* p/ I7 s
}1 _( r/ x) U" R5 g; |7 z: g9 t1 ^
document.write('</td></table>')
5 }) p9 {2 {, v! B}4 T+ R+ N$ p6 U7 c+ \5 c! k, ^
}; n6 t4 D o& M9 y$ l7 o/ b9 V* {
</script> |
|