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

|
网页之跑马灯文字特效
//修改宽度& l4 ^* U! S4 Z( u; Q
var marqueewidth=300
N9 h" f# L4 @3 K1 t9 y+ V//高度, G% J$ b% a! p0 F# w" `
var marqueeheight=25' G$ K1 p: I( a" z: E5 y
//速度(1-10), R# L& Z# C: r! [3 m" F" n
var marqueespeed=3& O/ L8 [& P5 C$ Y# o$ P% Z) z
//背景颜色
6 q. s( p0 J% X" W+ e6 I7 v- \! D# ivar marqueebgcolor="#FFFFFF"
3 K9 l0 x' M2 r( ?4 m {//是否能暂停 (0=no. 1=yes)?
$ Q5 }6 y" G, Z9 t0 D* Uvar pauseit=1
$ e; m3 g% T i, c4 P8 n3 y2 k1 M" O8 x m3 E
//修改显示内容4 y9 j: F6 M! K$ q+ x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% N$ I) r! i! Y) v6 U1 d7 `7 w) K3 Q7 \- t& t
) u# v( s, ~6 K6 l////下面不需改变////////////
+ O& g: N j' R
3 ]4 Q2 l/ I" v( y8 L7 gvar copyspeed=marqueespeed0 w, w6 q! O3 j! |
var pausespeed=(pauseit==0)? copyspeed: 0; r |" n0 m% ]. y' c
var iedom=document.all||document.getElementById( Q8 x% d& ?, o) `0 O- y* s) c: f
if (iedom)- U* d$ H, N3 b7 K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 H- x, Y2 [- P/ Y; r. D$ Hvar actualwidth=''
# ^/ b, F6 ]% K% U5 ` bvar cross_marquee, ns_marquee8 x% Q3 x3 w( R: w/ u" t
2 ` K4 _; f4 k9 J! [function populate(){* ?' }( t' V0 V
if (iedom){
7 R, W+ L7 K ]: M; across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 S$ B/ |- f. {
cross_marquee.style.left=marqueewidth+8 j: c0 r" ~% v& `# n
cross_marquee.innerHTML=marqueecontent
7 \. I0 ` O+ m4 l' hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ r9 ~7 d9 X- z6 ?. d1 z. m
}
7 U6 B' z: n6 n. K5 {# W6 g8 Qelse if (document.layers){* \) w) }. Z- X4 i6 A6 ?
ns_marquee=document.ns_marquee.document.ns_marquee2# P0 R. L H; E6 t
ns_marquee.left=marqueewidth+8
3 f/ r- M9 }( I+ v. H9 t+ @ns_marquee.document.write(marqueecontent)2 n& ~& ~1 r j g/ p% X
ns_marquee.document.close()9 J) O+ g) j4 m% a8 k2 b& t2 I
actualwidth=ns_marquee.document.width
6 c' H4 V* g6 f8 F" Z) p}
9 l+ h1 @" z1 U1 _' b0 Klefttime=setInterval("scrollmarquee()",20)1 e8 P; G p" l! z
}
) k6 i) z( Y) m. G. D' Jwindow.onload=populate
( ]5 Z) e \( e1 o! i8 P+ {" P/ U" D) W' K) F' b! V5 L
function scrollmarquee(){6 `- F$ g& v( |+ c
if (iedom){3 P' w* p0 f# {1 R: d& q; `/ i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 ?' w" n, x7 _2 Z3 S5 O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, p: V* e+ g: K0 melse. ~9 f* Y) k$ @) v
cross_marquee.style.left=marqueewidth+8' k7 ^, h6 D, o* G8 M( K, t3 ^
B7 G1 C- Q4 j% J% Z}3 L, z+ B. O% t& a. c+ |
else if (document.layers){
( W# V0 Q& C+ v. D* w l+ F- bif (ns_marquee.left>(actualwidth*(-1)+8))
# Z* R! R! E2 a$ B+ m7 l+ k+ @ns_marquee.left-=copyspeed) F; U8 r% k" E3 U( Y
else, d" w$ ]" G9 X; m
ns_marquee.left=marqueewidth+8$ {8 t' B/ M5 N9 ~9 k9 N8 W
}
& g, s" C" }8 F; H. P' h}! _% p7 \ J6 W) L
3 ~6 }; Z( x3 V, xif (iedom||document.layers){1 h! R' i( p. O$ p' ]; u
with (document){
, \& e, P) k/ Sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" S7 H* b5 ~- T- n& s- F
if (iedom){
2 f+ T0 F; W3 o S) u/ r! Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' X- P" n. B- f+ ]% Y* kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# T, i: \, r c6 O% ?1 M0 o& U1 D+ [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& F3 U% m; M& B( J, twrite('</div>')& x8 o& Q7 p( Q3 F# t3 r+ E6 N
}
( m# I2 |% F* U+ Lelse if (document.layers){/ f5 H, {6 o! u' A4 U/ E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ x# K. C9 V4 b! Y V8 I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 q! E8 B% U* ]- P e
write('</ilayer>')
, E" }; [3 M8 e: t6 U& ?0 j( M3 q' f}* j( [1 d6 ]1 t
document.write('</td></table>'): F9 G3 U" d, }3 d1 S
}
V, x3 o, u& i2 p! G, N9 J7 S}9 o- H. \3 E( h* \( X+ Z
</script> |
|