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

|
网页之跑马灯文字特效
//修改宽度7 j# D+ w+ Q$ s! a
var marqueewidth=3000 H* j; _& r3 R% ^
//高度
8 l1 _* s% t4 r! K8 M+ {var marqueeheight=25
1 k( A6 ^# e+ k: Q! F) x% s, T//速度(1-10)
2 n' Z n7 K6 Ivar marqueespeed=3 ?0 n& v W+ c% U1 K8 Q3 r
//背景颜色
2 `* o) Q. r, F+ [) I! ^% uvar marqueebgcolor="#FFFFFF"
. ^: O/ j1 J, S" X. W) t) r. s//是否能暂停 (0=no. 1=yes)?; z' i% O5 C# q5 j
var pauseit=1
$ e' @4 [+ E4 U2 Q; X+ A1 t- f4 _2 e+ P: Y0 x, H: {# |
//修改显示内容
: r/ l: _, e5 r7 `- y% n" _) Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& `' X" E2 ? A3 ~4 C5 W; V. v
5 K6 O' l J. n////下面不需改变////////////1 o6 m1 F! U% [4 a P: j2 x+ Z5 Z
& p% _9 i0 \6 A
var copyspeed=marqueespeed
# l4 d5 O7 A% e5 F; S* ]* Cvar pausespeed=(pauseit==0)? copyspeed: 0
a4 E; a/ H- h3 d) lvar iedom=document.all||document.getElementById! g3 V) |$ t9 @6 G; P$ K
if (iedom)
4 X3 t5 u, R" H3 ^8 fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 ?! k( {, ?# M* x
var actualwidth=''. t2 D8 [: e( i, p% w
var cross_marquee, ns_marquee
) h% {6 H9 `2 m* j# r+ b9 K! N5 @, _, h
function populate(){0 r& @8 G+ ^, F& a( {& x' q* T q; r
if (iedom){, w# l0 e) C! B+ [! n& B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 P, @ V5 M9 y* W. p/ R& G
cross_marquee.style.left=marqueewidth+8! J" R; M: U3 P3 P4 B; u( p
cross_marquee.innerHTML=marqueecontent1 w/ ^/ u7 R8 b6 W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 y$ s c% X0 y4 G& Y% v! A
}
, U/ m5 c0 e d# qelse if (document.layers){# P' }8 I( Z: T3 B7 m
ns_marquee=document.ns_marquee.document.ns_marquee2! v0 ^' T% L2 C$ p0 H2 f7 d
ns_marquee.left=marqueewidth+8
, b9 Z! a; R. g) r8 ]- Sns_marquee.document.write(marqueecontent)6 I7 P: ?8 K7 {) N
ns_marquee.document.close()
& b0 T! Q$ x! xactualwidth=ns_marquee.document.width
) o7 W- i' K& m) Z! h}
+ m6 I+ }: w3 |- b0 H$ flefttime=setInterval("scrollmarquee()",20)3 Z; o: {6 r x1 u p: p. P
}
( t- a8 n0 y' U, O4 Y: l; k2 }' hwindow.onload=populate1 J; y( q2 o1 F _( a
' |9 C4 I$ L& @0 {" \function scrollmarquee(){
, t/ }% B4 C. H1 t2 Q) Rif (iedom){8 }' Z( u+ a! ?! a. j2 t. |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 h( x3 U9 L, U) l7 n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 a- K2 R' c. G ^% L+ ~0 k
else3 p3 D9 K# t9 r0 a; A
cross_marquee.style.left=marqueewidth+8
" c! n' k6 X+ v; b& X$ k {& j$ w( J" G, t& q
}
C3 ~0 ?4 k, a) L+ @0 i. helse if (document.layers){
& j3 a/ K" _. g; ?0 R. F1 eif (ns_marquee.left>(actualwidth*(-1)+8))' y/ `8 i2 B# D0 L- _- v* @
ns_marquee.left-=copyspeed
4 J' f( j' C" s$ g& d) ^else4 G! }6 L4 M0 a1 m6 Q
ns_marquee.left=marqueewidth+86 n2 ]+ e* B) X5 x# a0 ^1 ]5 o' S
}
$ b5 p/ b" Q% W6 d: E}
& t$ x, S( W- Y2 B- w9 P S. j
2 h/ I. v1 P. }; R! ^if (iedom||document.layers){% ?! y6 b2 r4 A$ ?) T) N* q6 x3 Y3 `
with (document){# S" v! M: L# `( L( B0 H- C K! I/ F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 w% e, i+ k& ?7 {$ f+ w" Lif (iedom){0 y) ^# E. ^6 Q. q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 @3 E4 r$ C& ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): F# B0 \$ I7 h6 D$ }; o) J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; a" B" _* [1 @- W& qwrite('</div>')) Q H( r* N) E6 I8 m1 b* b
}: i6 P" S3 x* f9 t1 ?
else if (document.layers){% p, M; E+ j! C9 V$ ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 E) T9 F& e ]1 ^- G& S$ Y% W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 ]' h$ S3 Y& C; U7 u g2 Fwrite('</ilayer>')8 @% i1 v& n7 ]3 d1 S# W; Z- \) f
}' p5 }- I2 n5 g4 S+ v
document.write('</td></table>')- K3 j$ l t! N8 I
}2 T4 P) R( O" ?
}
( E, ]! t* T) C: _; Y</script> |
|