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

|
网页之跑马灯文字特效
//修改宽度8 A9 a |) r- q+ m. B9 P
var marqueewidth=300
( c! I, V6 h' H) `+ L//高度% O' i. i4 D+ J) R' y
var marqueeheight=25, r, J) G2 F; a9 {8 x7 B
//速度(1-10): s2 A' ]8 Z* z' ~- O$ W: T
var marqueespeed=3
) ^9 u' j, Y- X//背景颜色
' Q8 W: o6 u; ^8 Ivar marqueebgcolor="#FFFFFF"
3 T3 a1 I# a, T" m//是否能暂停 (0=no. 1=yes)?6 Q$ X( E) ~, A
var pauseit=1
: U; S& l* {. |3 ], K" i
0 g, S" f& T7 h8 x5 \" B: _//修改显示内容 t1 i2 ~4 V3 a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) G( d2 ?2 l5 Q1 Y; y, n/ B
) M, L. z9 C# W
$ h0 H4 q1 e6 c/ P7 i/ `8 }& q////下面不需改变////////////
4 b+ `+ V- K2 i: |% z5 v1 n6 i3 x3 A8 E& U" t
var copyspeed=marqueespeed: f- T+ a6 W# j' ]- q& q8 K
var pausespeed=(pauseit==0)? copyspeed: 0
& ^5 W Z3 ^* X$ U' m( r* W6 ovar iedom=document.all||document.getElementById. S$ C! m/ F( ?* v' Z1 z$ l
if (iedom)2 @6 B- z$ u3 ?1 Q& ]9 J" ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') v6 c& W2 f( j: g, y9 d$ h
var actualwidth=''4 i9 p# E. G$ n5 ?' H
var cross_marquee, ns_marquee4 I! Y& W& n1 a4 P ^9 y
: H9 u R S; q& u5 G# i$ {! {& j
function populate(){
3 ?4 ^; K' x, H" T2 cif (iedom){( U0 O) M+ G f0 F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% ?2 ^; T# z9 y* d- [) o
cross_marquee.style.left=marqueewidth+8
$ A8 H! a m0 _4 Y' b: ycross_marquee.innerHTML=marqueecontent
0 C3 k8 }* n. N2 X# F9 W; \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, ?( T! b1 u' n6 E6 [/ U: q
}
8 j3 ^% q7 E" xelse if (document.layers){1 O9 X- [2 [# R* A$ R
ns_marquee=document.ns_marquee.document.ns_marquee2; x7 @) ?% O9 d4 r. t& y* q
ns_marquee.left=marqueewidth+8
, u2 O6 W" P, v6 C( n7 O Jns_marquee.document.write(marqueecontent)
- B a) K+ ~- t* ]) gns_marquee.document.close()& L" }8 r* v; C$ z. ?
actualwidth=ns_marquee.document.width
! ~1 \0 E6 w9 P7 @9 f: ]}6 |; H, o- U1 \5 T) b! P
lefttime=setInterval("scrollmarquee()",20)
6 P6 u( E/ x) A* s& U}, R3 w" S! ?2 [3 ^
window.onload=populate
8 W) p9 c% ~( B5 R' Q, K0 _7 v# F+ P- n( Q
function scrollmarquee(){& U) t( S2 f ?. s+ n
if (iedom){+ m( ?$ p/ e+ t7 Y: @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# _0 p2 d5 J) c0 q/ d) Z% wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( Z- {+ T- i5 ~* |
else" G( D2 W# N( w0 N( c+ k: k4 h
cross_marquee.style.left=marqueewidth+8
7 V- t. @: L# L2 Y" K+ R( e0 H' S6 p9 _* b3 K$ s3 a: d% m5 s
}& x; b( O1 \6 J4 f8 ^
else if (document.layers){
( x* g# ~6 q5 G; i; b9 zif (ns_marquee.left>(actualwidth*(-1)+8))
7 ~* H2 u3 R8 O# _+ s- \& h0 }* B8 Sns_marquee.left-=copyspeed
5 m: F/ O! K9 U) yelse u/ j/ q' W* s
ns_marquee.left=marqueewidth+89 U3 k# i$ j2 u. n: t0 m4 X
}, C* @" r3 a: w a
}: }' w% I# K. c* r) M
+ D. j- A) p/ m$ q
if (iedom||document.layers){( v! [! W. {/ ` X# B5 ?
with (document){
" \: z( C; A5 G; J( r' s. Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ N/ D) K: [* _) _* s. o3 s& R
if (iedom){; T* G& J5 W3 j7 ]$ ~5 f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 S, h$ ~$ }- N" H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 I% E+ D+ A* ]+ `% G& j2 Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! R. Q2 \6 p: W2 f3 ^. ]7 j* }4 twrite('</div>')/ e" z8 j; w! i; n
}5 J6 S1 v$ q" x: Y- {. Z y
else if (document.layers){* n+ R/ |, i8 l# ~" m4 K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 }1 w! t, j" o4 D: Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 W5 f' _' ]. U( J* g
write('</ilayer>')4 e k, _" Y+ \& ]
}$ S& ?" G5 Y0 `' A. d( }: Y
document.write('</td></table>')- b3 j4 X0 a4 w$ X& a8 r6 [
}; s1 k! D1 P* m7 O" {5 a* R# y
}5 R m# z0 F. F+ E
</script> |
|