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

|
网页之跑马灯文字特效
//修改宽度
% s1 y5 c! a' G4 t9 E' Lvar marqueewidth=300
7 r; Q( W# b# t& m0 p//高度
% Y: J" n* g8 O8 xvar marqueeheight=25
* F9 p% g v3 {//速度(1-10)" Y, P" }2 Z( C
var marqueespeed=30 s7 T& q7 j ^) L3 g
//背景颜色
/ Z% ]# N1 {. Y( G5 C/ kvar marqueebgcolor="#FFFFFF"
7 k/ W D& D8 j//是否能暂停 (0=no. 1=yes)?
, B S+ n3 S& U# H3 [: f) F5 evar pauseit=1& C; t% A- V: t2 N
7 \1 o: i/ }( V% H: S4 O$ M7 x//修改显示内容
# ?! w8 E2 y# U% S* g. ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! E, z* _2 G* k% Y, P% O! q9 ]: U( _. G6 N9 V
4 p4 r7 z1 `/ I- c
////下面不需改变////////////6 K: M4 M( l& c
- x- `/ E# L$ E m% j! dvar copyspeed=marqueespeed
, B4 M& f/ B/ |/ D% ?) v; ^) [ V/ Mvar pausespeed=(pauseit==0)? copyspeed: 0& a0 D$ d) i4 H, a
var iedom=document.all||document.getElementById
( n& Z( O4 G* \) I8 bif (iedom)
) ~; U% J) N3 J i( ~# L0 {2 ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 h3 C5 n% s- u, X$ Tvar actualwidth=''
2 x0 j8 [) i4 `% m6 E: fvar cross_marquee, ns_marquee
+ H6 u6 g/ P6 v, C0 x$ s3 _% x' U8 w0 E) I# v8 s1 y
function populate(){: q, a- l1 [9 }1 Z
if (iedom){
) G$ Z; E7 ?% ?$ Q) L1 Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( ]; P: X, J3 o* h* l, A/ `- j* D
cross_marquee.style.left=marqueewidth+8( f: J+ H- t( G' e4 P, S
cross_marquee.innerHTML=marqueecontent
4 S s, f n+ k9 x# dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 X* D+ @; S) d1 A4 {: R
}; l0 Z' @) {0 z J$ i. q& Q
else if (document.layers){$ B) b+ Y, j: ~% w: U
ns_marquee=document.ns_marquee.document.ns_marquee24 t# u& i& p& A L
ns_marquee.left=marqueewidth+82 u5 R! _7 r% X! M; }0 D' v7 Y
ns_marquee.document.write(marqueecontent)
2 ~: Y5 @. h% s: u* `5 ^ns_marquee.document.close()
: u' H8 Y/ ^8 ^actualwidth=ns_marquee.document.width# I v. l. g! \$ H0 f5 B3 v
}
, Z) H/ M; U. O2 C+ @$ c4 ^lefttime=setInterval("scrollmarquee()",20)
9 c* I' E) n; [/ e}
' Y% Y" ~# Y$ d; U( v nwindow.onload=populate
3 |$ j7 w4 [. p9 L/ S8 O
$ R2 \: n. X$ ~$ w3 v+ W: e1 j, efunction scrollmarquee(){" `7 Y+ ^/ J/ Z( {2 I2 v$ x) k
if (iedom){
9 E/ y- @' D1 j. F" rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 L3 a' V* m2 ]8 Z4 Icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( J/ c& @" e! } [2 d1 f
else- h3 Z& X6 C+ Y/ D& w- V
cross_marquee.style.left=marqueewidth+8- }7 z& Y( t3 k* I& y# z% v
; ]" {+ p# s1 m. P7 M
}! _ O; H. [4 R7 ~) ^
else if (document.layers){$ B* B9 z% q. `1 W- p. @8 M
if (ns_marquee.left>(actualwidth*(-1)+8))
5 S' V6 {! y2 r6 N, Z. I( ~, yns_marquee.left-=copyspeed
) E" W8 S+ E- Z6 }% J/ n( nelse7 u7 q$ _& \1 L8 o, k0 O
ns_marquee.left=marqueewidth+8$ T! Q" D1 J# h9 O$ }) {
}+ {5 E6 r2 W/ Y6 G. Y
}* s8 q# q, @, e- C+ |
3 } k5 q0 g4 ^ S4 @2 Iif (iedom||document.layers){* v( A0 O- I* ~+ G
with (document){& U2 @$ L" ]5 S1 E, o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). e0 ]6 z5 e+ U, Y
if (iedom){
) e4 b- `+ g ?' ]: q0 l3 Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 P: a; e6 P8 c9 q% ~3 m0 D7 K6 \4 b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* ~$ a) r) ?) {: M k4 [+ P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- G h, W @* ]) K: \
write('</div>')
% h5 b6 N8 _5 X+ ^% @0 y+ c}
4 ]( {% H7 d9 u+ g- Aelse if (document.layers){8 C: S: m1 Y, W/ G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 \+ a" C9 \1 v" v# s' K" y; L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 p( ?6 F: x/ {* k
write('</ilayer>')
) }* W- w4 y# B& t, V R0 n}
/ ^- x8 W! @4 ?0 R1 `) @6 N. Pdocument.write('</td></table>')0 W4 Q+ z" M$ Q' j; N
}% a7 D. M* z5 R
}+ [6 Y9 N, f: v
</script> |
|