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

|
网页之跑马灯文字特效
//修改宽度
- x2 `4 {- c/ } O8 qvar marqueewidth=300
! |8 K8 F2 n' G. N8 X//高度
7 d* R8 Z( _( f3 Bvar marqueeheight=25/ p4 J/ o* d- b2 u6 [; W
//速度(1-10)
+ E0 a; O4 C& D' i6 w: }8 Tvar marqueespeed=38 T: C4 P5 L0 D% U; x: i) n/ B
//背景颜色4 T) N8 m, O; F
var marqueebgcolor="#FFFFFF": W z5 [ R" P6 j
//是否能暂停 (0=no. 1=yes)?, |' I3 i) }/ A% _0 h; z5 t
var pauseit=1
9 P. u `& G- J9 M4 t( k" I* J# q2 ^$ O5 |+ s( f
//修改显示内容( e! I; ]# p& d4 r( C n! |
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& E$ f4 M; n# j$ e% Q1 V+ {. O
, I4 n2 j+ _- d, m8 c& h7 [* A( z I, h6 X' \6 C$ {2 ^/ L
////下面不需改变////////////
/ d% _* T! {0 ]- U2 A6 Z% K
) ^5 E' L) f: x: l; T1 S2 Svar copyspeed=marqueespeed9 ]7 @1 B1 S2 l0 B1 c- H( R
var pausespeed=(pauseit==0)? copyspeed: 0
& b% i" i: x7 r5 {7 N( i) N# p% wvar iedom=document.all||document.getElementById1 n) G, q% ^9 X+ r4 E* y' \
if (iedom)! A9 ~# J- V+ z8 L1 C. b0 V9 U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' U1 V) {; Q3 q. d, @7 I0 w, Gvar actualwidth=''& l3 H3 g# m( i; i# K) W2 r
var cross_marquee, ns_marquee
4 y) ~% u* Q' V: G* H
% c3 ]. ?+ ?( Pfunction populate(){8 f/ ?1 P" w- W* p. J" R8 D0 g
if (iedom){( ?- t- g' ~, S8 |1 ]1 L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& u! f. J$ `# z y4 t& I
cross_marquee.style.left=marqueewidth+85 ~9 J# h( W* T6 ?& ?4 d
cross_marquee.innerHTML=marqueecontent, `9 n4 P4 X! c3 W4 ?& C. n+ l9 W; w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- G, H! _( B! ]' m% h4 O2 Q}4 W) }0 l) O' Q( K& q
else if (document.layers){
0 t! O5 l" I; q( H0 e- z# k+ kns_marquee=document.ns_marquee.document.ns_marquee2% L/ q0 j b. X! P8 A% H
ns_marquee.left=marqueewidth+8
" @! O- H0 g4 s. xns_marquee.document.write(marqueecontent)" o0 Z" g8 h( z" ~' s) x5 q
ns_marquee.document.close()
& p, D8 L0 D! A8 t' Bactualwidth=ns_marquee.document.width
* S8 K0 p3 s. z4 V' D}4 \0 G/ x d2 _% Y
lefttime=setInterval("scrollmarquee()",20)
( _$ P2 T5 t" o, U}' |' d( m, g7 l( J' x% S6 r! L9 E
window.onload=populate
( F* F- T* o" y
. Z1 E8 ]( g& N, ]+ q6 nfunction scrollmarquee(){
5 o8 m, ?0 x9 Z9 Zif (iedom){' k; {+ f) B9 A* c( K6 y0 w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! c. \* |9 i% m7 F
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# ], ?& p$ \8 gelse
/ }+ z! n [; e" H' _cross_marquee.style.left=marqueewidth+8
% j6 C3 J* I! j' U8 B4 u/ c* c/ u: H+ D; F6 i7 a/ }! G) F/ b% s
}) G# s4 Y. M3 K1 i
else if (document.layers){3 _( b; g: K! ?9 H5 G& b6 H% h
if (ns_marquee.left>(actualwidth*(-1)+8))
, ^( U! o7 L% `8 E- xns_marquee.left-=copyspeed
4 q7 q4 E+ P/ M: h* U0 w5 Oelse6 `) w/ R, ?' J* H- P* v3 j
ns_marquee.left=marqueewidth+8
1 D0 g1 I. G& S+ A: L( ^- n* U. x}
% W+ I o5 D; [9 d; ^7 T}1 N, b+ l" J+ t7 D2 }7 o) y e% L
' G/ K$ O c9 C4 J$ |3 Sif (iedom||document.layers){6 M9 C0 S8 L# P2 i2 t' v; {& M/ }7 A
with (document){, |, A b' i+ w" J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. U. r* b* T( dif (iedom){
( v& U1 I( P h; W) K! r r" Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" b: K4 ~. k5 H; X9 A& y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 [2 w) ]3 n5 F# x8 e, ^( O& e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 n! z/ v- F4 v
write('</div>')
* k" K5 n* H% E) j}/ s4 P( F( e8 r# ^3 x7 o
else if (document.layers){9 e. e5 ^' Z7 z' @0 f" G- b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! y5 z+ m/ r) `3 B" ?' l4 wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) v2 T) Z# _" D) bwrite('</ilayer>')4 b% K9 B( B3 m4 M8 C+ P
}4 {8 E; F2 T) @7 O. j' y
document.write('</td></table>')- U: i$ j! b! H( V8 n
}2 Z, k- K: Y' f+ G7 Y. r: p; q
}
6 K X1 |$ Z g* O/ E4 j& a</script> |
|