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

|
网页之跑马灯文字特效
//修改宽度
# U3 j+ M0 r" v9 Y. q! c( W7 T1 Rvar marqueewidth=300
5 o, ~% X s& }+ v1 h- |//高度
9 s; V% [, R( T! I9 d: evar marqueeheight=25
4 V, P9 X0 t" G, t+ O//速度(1-10)' r6 P* }* S7 ^
var marqueespeed=3
6 p. y0 X) C0 Y: t4 o//背景颜色2 z# t' f8 }8 z
var marqueebgcolor="#FFFFFF"& y4 l/ J0 Y) ~# u. Q. k" @
//是否能暂停 (0=no. 1=yes)?
8 o: B8 r& s: v1 g4 Dvar pauseit=1( p- _8 B. p, N! h3 ]8 d" `8 G
8 f% {! o5 j: [# ]0 V6 e
//修改显示内容3 v1 V+ s- b6 W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* O' K/ c8 |: \; i
! ^3 K9 n# ^* \! q6 E( Y; b, H
5 f! g! W1 s1 g6 z
////下面不需改变////////////
9 W, B$ {$ c. n" N- g$ U4 C
% c/ }6 @3 {$ s" m( T& z9 t3 kvar copyspeed=marqueespeed
6 \+ k- {! I; n% ~, f" ^. Tvar pausespeed=(pauseit==0)? copyspeed: 01 M9 Y. ^8 I8 z; k3 e* p
var iedom=document.all||document.getElementById
% K( \1 ~) t5 E# ?0 W+ }# [ g- qif (iedom)0 G- f' L+ c, I* m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ u: |" A6 ~; B2 R% k
var actualwidth=''% e8 L2 S- I* T. Z0 E
var cross_marquee, ns_marquee2 C! J! U, x: @- \9 D
) j& B q* E" T" gfunction populate(){
+ U1 _+ o$ V0 ~' c) Cif (iedom){
3 ?( G( y+ d* R* Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& p* s B/ E/ U L" P$ U
cross_marquee.style.left=marqueewidth+8
- n& ]5 B. A7 @* I8 Pcross_marquee.innerHTML=marqueecontent
# [5 n" y! G5 M6 xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 [7 t5 x" }6 x! ?% f}
/ L$ p% q, H1 z& O+ ielse if (document.layers){
% ~2 E' h7 q4 U) y4 @+ T8 a& bns_marquee=document.ns_marquee.document.ns_marquee2
9 x ]. p% y; }; F: _9 l6 J+ Pns_marquee.left=marqueewidth+8! B- S* a. d/ @8 e1 D [6 F
ns_marquee.document.write(marqueecontent)* Z: ~! m- }2 Q6 {& }) W+ W& D
ns_marquee.document.close()
* d- F( i2 b- n6 L) v8 ^actualwidth=ns_marquee.document.width
6 U; _. M* p7 I4 K. |. U& ^}
3 i. i' F! l$ e9 T3 Q( V4 Ulefttime=setInterval("scrollmarquee()",20)
; T% l4 [, e& Z. X2 K1 s( l}
- S& I L# C8 A* hwindow.onload=populate4 ~9 W4 P) O( y
1 B+ M' P2 R& o% k$ ^: E6 N: Yfunction scrollmarquee(){) M' o3 W% M5 f+ _# N' u" F
if (iedom){# a3 k/ p; P3 R+ `7 Y0 X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% E# E4 u! x+ N8 R7 K$ c( Y6 [
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" h& ^. _* c1 Belse+ H: |1 @9 I+ r
cross_marquee.style.left=marqueewidth+8
K# K, o" }/ p9 x" [2 z+ K4 M! K x+ r) Q+ _- |% _
}. O; ?9 a& t8 l4 W. R, w9 T; V# z
else if (document.layers){0 z& K* C: ]; B0 M
if (ns_marquee.left>(actualwidth*(-1)+8))
5 O2 \8 Y/ g, S8 Nns_marquee.left-=copyspeed; k2 T& b$ _2 k) k3 C I5 n/ K5 u
else \- Q) E! k9 W+ C& }. f, H9 r5 \
ns_marquee.left=marqueewidth+8
6 i7 R# j# n- u; a6 n}
% e/ C/ y( G# }}3 D, H9 P$ G/ j+ `1 E
9 A% ~! w' S3 S" }' h9 fif (iedom||document.layers){
9 ]2 B/ @! {4 q" d; \' Y3 J8 xwith (document){" j, G# B# N; U0 F7 e" c0 e+ n. ^( ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: H7 q P/ W$ d1 p* a) J0 fif (iedom){% i" N+ y. m i( W% e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 Q1 |( K) R- Q, x1 j7 b- ]$ W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: J3 A6 U- a3 Z, Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 \8 K* A( s7 \1 d, `/ O
write('</div>')
' R$ f8 e2 V2 J3 t o6 M9 h}
/ q8 i8 h, S" kelse if (document.layers){
+ N2 _ W/ a D# {" swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 j6 c4 q4 a4 k: V. Q7 I0 ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, p" k l- ]7 r: _, P9 l/ H1 rwrite('</ilayer>')8 R: F6 l/ N) u* T4 }% c4 G2 x
}3 [6 @: Y* [" v j+ f/ e0 J
document.write('</td></table>')
% F& |% ?" N; M. K0 W5 [}, h7 n* r0 \( R, D, _
}
, u2 U9 m' O/ _& C</script> |
|