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

|
网页之跑马灯文字特效
//修改宽度
1 }* j( U) n0 d6 o) b) C+ {2 E1 b. }var marqueewidth=300
6 P0 r0 Z; z6 p1 Z" F//高度2 B8 O# n9 [ |9 j9 d& `3 l
var marqueeheight=25; f3 Y4 W& U5 [* `: `: D
//速度(1-10)
' E% c) S# j1 J8 h1 s1 K9 Wvar marqueespeed=3 Y! w& u! }' l7 l2 k" W
//背景颜色
$ t. N7 L$ |! U7 L4 pvar marqueebgcolor="#FFFFFF": h+ H9 E5 ^, W- r3 ]
//是否能暂停 (0=no. 1=yes)?
7 c/ t( Y, X3 U8 T1 z$ Cvar pauseit=13 h8 q; O9 Q* Z& C3 I4 `
- _1 T/ m0 L( X
//修改显示内容$ I2 f! ?# X5 k$ R! F* e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
T+ B) l% S/ j; b& E6 A
d$ h% l6 {8 d2 t7 R* Y9 T+ X+ @3 y, W) M4 L5 b
////下面不需改变////////////- B5 h: V% k3 w
% Q+ z( x2 j9 L5 h! m/ D7 d
var copyspeed=marqueespeed
# p, l6 k; W+ m a. ^% _5 h5 ?var pausespeed=(pauseit==0)? copyspeed: 0
% o6 p/ v7 e0 b& l1 W' n% {' ]: wvar iedom=document.all||document.getElementById7 k0 h0 S3 d$ t4 J8 h
if (iedom)! l* q5 @; s8 q! n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, N8 y3 F$ e( u; Z! y# \var actualwidth='') G, B- j4 U: z& P
var cross_marquee, ns_marquee2 p1 @6 z D3 c
5 Y* y# d0 t, y* f5 w. h
function populate(){! U5 q4 b- o# F1 y' g8 `
if (iedom){
: Q. i( Z/ `$ o- K2 l9 hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee v& _. x' C1 B' {: J# v! ]
cross_marquee.style.left=marqueewidth+8; ]1 e9 D4 K* M- J5 T" W' C5 O4 b2 G
cross_marquee.innerHTML=marqueecontent
+ I' P+ X+ {. R% k- Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: ]9 A) K- ^% j}- t5 ~! v( N7 z
else if (document.layers){& U( Q" E% U& e3 S" O
ns_marquee=document.ns_marquee.document.ns_marquee2* ?. ]0 }( E: B, l* |
ns_marquee.left=marqueewidth+8
# U8 b, J D2 P7 M6 uns_marquee.document.write(marqueecontent)* i. A6 W" \( h. a- b% S
ns_marquee.document.close()- V% ?# g; D& E
actualwidth=ns_marquee.document.width
* q4 d* g! m6 T1 O3 c}
2 [ G ?$ Y1 ~% S9 b6 J& T, H5 ulefttime=setInterval("scrollmarquee()",20)# Y# m( e& K! L- a0 q2 c" h. i7 M" D
}
( \+ ~0 Y( s& `. W! B' ^window.onload=populate: X3 n |, Z I
) h! A/ V" B2 G* [$ S2 Bfunction scrollmarquee(){
6 I4 ^3 j- B& y5 ~( N1 h2 aif (iedom){0 f2 B# q/ u0 N/ Q2 R2 Z/ e) l( f2 [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( P3 R$ p' r, k& y# g- bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ C" w' a" }* s+ N7 n9 T' K
else" X# q7 g& F# ^( V: Y+ f
cross_marquee.style.left=marqueewidth+8+ b7 W" b* y1 f0 m7 u3 A
7 a8 X- v1 K& b( L; d T$ G
}
}+ ^2 I2 L4 E) n6 T% pelse if (document.layers){2 E. l G5 z; \1 Z9 N, ^
if (ns_marquee.left>(actualwidth*(-1)+8))1 `( a7 s5 c* [. w
ns_marquee.left-=copyspeed
/ R" P; ?) L* g8 ?( \. N; o+ G5 pelse
! \ [$ E2 N. B3 M! U3 {+ o% Xns_marquee.left=marqueewidth+8
" N- ?$ W7 N0 J5 F8 \( o}4 I1 T( p) j% q3 y! C2 T
}
: R+ A2 i, \% F7 a* d5 D
7 d4 e9 [' g F0 _5 y( b5 jif (iedom||document.layers){, n" X+ O6 h/ N$ A
with (document){
- g J# h, E7 Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ w0 g7 R6 m+ b8 T3 Q! @/ i! Z3 m" gif (iedom){ S: }- L3 R+ ]2 ~; s0 l2 ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% ?+ b2 s5 N g7 @8 a0 j2 k- s" K1 n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* E8 D& h; _9 h* |% N
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ z, b0 E# `6 c# l/ N- y
write('</div>'): j# N1 H$ H/ E; _* \+ w
}) H9 x$ l [# N+ d: A
else if (document.layers){
( L, _! v) x6 b. vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 v6 Y$ z5 G- N7 y4 J1 \ b0 Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); E q$ D1 j$ W, o5 f
write('</ilayer>')
& O- R8 t/ g% w2 K) t' ^}; @6 J7 Z! b4 L9 }* A9 n W
document.write('</td></table>')
0 t; w+ U5 q( s- W}# L7 k5 P P. v& w/ {* s( T
}7 e6 ~, l, K. \. J. R
</script> |
|