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

|
网页之跑马灯文字特效
//修改宽度$ I6 E6 M& w7 f& {% k: i, |/ F
var marqueewidth=300* w. `$ ^/ R" Y) u
//高度
+ b `& x, t8 N+ n5 N& {$ G* [: \var marqueeheight=25 v' _4 \$ x5 Y2 P$ h
//速度(1-10)
4 s0 p! r) x& m8 M) Cvar marqueespeed=3' P$ ?$ L( d) l, I T/ `5 @( z
//背景颜色; O2 I$ ^4 G8 P% ~% |, W/ q9 d1 t1 y6 N
var marqueebgcolor="#FFFFFF"1 X8 r5 J, N$ _) m: i& e, ?
//是否能暂停 (0=no. 1=yes)?/ }4 j. G1 d+ P2 T3 K
var pauseit=1& |1 m4 V* o! Y1 v- N
3 e2 d5 U& \) Q: v2 K5 j
//修改显示内容( X+ ^/ Q3 t+ G) ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! z- c9 H! }+ }+ s+ ~0 L4 s. L
4 d4 }) L; d) o3 i$ D
" _7 r+ |$ i# \5 q# z* p. G' h4 Z////下面不需改变////////////
- \7 }; A& R, }9 E
6 w, L! O7 T/ F; ~) s$ a/ @var copyspeed=marqueespeed
. p: E* }! N" Q: ] {7 _) Tvar pausespeed=(pauseit==0)? copyspeed: 00 g/ l2 S3 j4 l! W# _+ m, B; n, e ]
var iedom=document.all||document.getElementById
. d4 v6 O3 C+ m: }" I7 ?if (iedom)
7 B, O9 S* k/ `/ kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* b ]9 S0 C' N" [2 jvar actualwidth=''8 K8 r+ }4 A |, E
var cross_marquee, ns_marquee
& ~$ U S2 D$ ]: |3 `/ z4 a8 _/ b9 N' Z3 _
function populate(){
; r8 g O- z5 eif (iedom){
6 K! y3 i5 s% q* k7 W5 Wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# o9 Y( H" t; L; C; w; tcross_marquee.style.left=marqueewidth+8
: w% N( ^- f( B3 q; Ncross_marquee.innerHTML=marqueecontent" c) U7 r1 P! m b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; }; [2 \7 w4 G: n
}
n: e: }0 h1 H: N8 Q3 telse if (document.layers){
) K {/ x7 h/ ^! C: m5 ?' H, Zns_marquee=document.ns_marquee.document.ns_marquee2
7 X& ]4 R5 {' i+ ~% z+ o4 T% |ns_marquee.left=marqueewidth+8
) y1 O1 R* [ s8 ~' _! X' [ns_marquee.document.write(marqueecontent)
% y; X! t% M6 E6 Q+ {5 ?. Fns_marquee.document.close(); e* s3 v# ^! @3 s
actualwidth=ns_marquee.document.width. m6 J2 X3 j: L% q2 C
}6 G- b( x; ~" A
lefttime=setInterval("scrollmarquee()",20)' t5 P0 S \ H: e, s
}
$ B# }: \* H+ U# Twindow.onload=populate& o v, O% h$ |4 h$ t
9 o- ~* L( s6 M1 @- |/ C6 H
function scrollmarquee(){
* M5 d, N3 e3 x* Q" G7 Y5 Eif (iedom){
) Z( a; }1 k" b/ }4 @- O/ b( xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- F" Y& W, k3 xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 S t6 q! q+ \+ H6 T7 j f
else8 j$ E# [+ t* H( N! r5 Z, {/ P
cross_marquee.style.left=marqueewidth+8
: V# c5 I9 \, Q% ~$ y5 B. q& l3 B' R: S
}
9 ]( Q _6 q3 ?& G) K7 k, E! Qelse if (document.layers){. a2 S- n( ? z' @7 c
if (ns_marquee.left>(actualwidth*(-1)+8))3 h% w) {9 f9 x' w; O e$ _
ns_marquee.left-=copyspeed6 `4 g; X) u1 T$ G& X6 U
else
8 e) [ Z$ b' Q% ]7 s$ H- W8 _ns_marquee.left=marqueewidth+8. j% B% ?* k `1 ^! i
}
) d/ ]6 q9 h) `: B4 N- h}
% i7 Z8 J& M/ Y3 O s8 P! o6 K% L0 s, q
if (iedom||document.layers){" P% R2 {& n4 ]2 o& _: `& |
with (document){3 [2 u, f1 b% B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! n8 B/ f4 G2 P2 f% R' }' N. j# x9 C
if (iedom){
7 N# q( \$ s T" |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ s$ g/ W) ~! |, v( N1 s3 ^! Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 @7 n# { J* s1 K( s' {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') C# n$ |- k8 B& {- _6 }
write('</div>')
8 c s! E$ N, u}6 a* u$ `3 y8 w# W& o
else if (document.layers){1 R% g, L d. ]: Y6 I) |) k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 ?% _# z g1 T8 b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 y' c; E) W' D
write('</ilayer>')+ _4 J5 P' N7 W0 S6 b2 C, N' J3 L
}
( v$ m& J% d2 w1 p# p5 a- R. M2 l4 Ldocument.write('</td></table>')* k8 T' T, J4 R& i* B- d8 w
}/ z) c/ ]/ N8 B/ t) j
} X8 N; T- x- d; h+ a# ]
</script> |
|