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

|
网页之跑马灯文字特效
//修改宽度: F( u1 H* I! f3 r& C
var marqueewidth=3001 R0 M& A/ Z' j6 P" G0 L8 [! A
//高度( X. U/ c0 N+ C, |2 I4 t
var marqueeheight=25% ?( W( @/ `1 w/ k4 [0 R
//速度(1-10)* N$ w7 A5 \' Y9 B/ X& l* w
var marqueespeed=3
6 e4 ~8 f& ^. r//背景颜色
. d9 d, a3 R- ~9 f3 X3 _, C1 w! Evar marqueebgcolor="#FFFFFF"
3 Z4 e7 r! Q8 r) }& o//是否能暂停 (0=no. 1=yes)?; i" J7 y& b5 P
var pauseit=1
' O! G% V: c t# J5 J0 H. V5 O
# j- }; {1 w/ k0 A//修改显示内容% d: n( Z9 C, {4 T' x# X9 t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* I+ ]+ W% y) v6 K4 I0 z, B& a8 x! w J
6 l, `/ w* h# b& p6 ]1 m- D////下面不需改变////////////
) e4 _0 C0 o9 _2 u0 Q# K% Q9 S! [6 H, T" |0 I5 g, O$ L
var copyspeed=marqueespeed
$ X5 W6 `) [, n8 l3 I9 E2 `8 Kvar pausespeed=(pauseit==0)? copyspeed: 0
: s# V9 ?) D Z3 P D: k4 Q" ]# y1 ]var iedom=document.all||document.getElementById
# M( @8 g- {/ K3 e- k, C$ x$ Oif (iedom)7 R2 t, R9 M. M7 w; T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' V* p p: O. I" Qvar actualwidth=''3 }6 F+ C2 R* q' e
var cross_marquee, ns_marquee' M" m( U) [2 p: [" n" N# o
! W9 R4 D3 |6 _& s* xfunction populate(){
8 Q) v2 K9 ^: t% {8 rif (iedom){
: ?7 f9 N" g: H% u @1 gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, Y- z* [ a+ N0 K3 l; b& ^5 |; x
cross_marquee.style.left=marqueewidth+8$ w8 {/ D( g. L# k- V2 `- K
cross_marquee.innerHTML=marqueecontent; f/ x9 `1 i; ] Y- ]) U$ K$ z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. }& L& K2 A+ T! E, s' W' ^. J}9 `" }) K: w% }3 @( ?$ W) ^; u+ w2 m
else if (document.layers){" O# z( b* P: {5 Y8 w) e
ns_marquee=document.ns_marquee.document.ns_marquee20 x6 w* e3 F0 q
ns_marquee.left=marqueewidth+8
5 B! ^. {( `: U8 kns_marquee.document.write(marqueecontent)
0 j {. S: v9 _# [0 m7 yns_marquee.document.close()
! v$ x. B3 p( l; a! _0 Aactualwidth=ns_marquee.document.width
1 Y- J2 H. {& S$ P0 n}3 l/ `3 i& r, D9 b
lefttime=setInterval("scrollmarquee()",20)6 w7 v, P- L$ E$ k0 P+ Y
}0 R7 }2 V8 n' H7 K. m4 _5 {+ D
window.onload=populate/ p o, t* [ I2 {
v- q( s3 `" {
function scrollmarquee(){
4 P: `, P: W- n$ j5 t3 wif (iedom){4 Q5 B1 e8 c4 k& `! a; ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) a% C4 j& U: F8 r3 U! y4 Z$ N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, w7 y7 n- J8 M
else* b6 z# E& P" {
cross_marquee.style.left=marqueewidth+83 Y/ z+ p# q+ s
$ p; l2 x8 X0 @9 C* Y8 T: i) u9 ], n. k
} _2 _! B+ J8 ~* m
else if (document.layers){$ G8 ? M/ I4 u# B% N
if (ns_marquee.left>(actualwidth*(-1)+8))% c/ W+ y# z3 I& i# h8 D
ns_marquee.left-=copyspeed
7 I% y+ ^" }2 Q3 r. H2 Relse$ A" X4 z a- u9 F
ns_marquee.left=marqueewidth+8! \# ]/ K; n( v8 v) `) W6 D
}; _; S8 _9 f+ w3 T" i
}: G1 [8 [# Z, `- I! A
' |, } ]' L% cif (iedom||document.layers){7 O$ c; J/ W; a. R- P8 h0 B: j
with (document){+ U* ^. R6 t$ n5 G8 Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ K6 y) { p+ b, W; w2 Hif (iedom){
9 s0 k! [3 n: R1 B* D" I; Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" t* b& r6 s# c5 y( b- i- a+ r8 C6 B5 b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 X- w8 _5 R, u% r! mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- M4 H1 K% A2 s( Qwrite('</div>'), i2 @ D$ T$ b2 [1 j
}( L& m8 d: h- I; w* R Y8 ?
else if (document.layers){
5 x+ _( B4 a/ R, u. f Swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* Y& g" |& \8 w( i3 z( ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 T1 g$ {! S7 z7 H& Fwrite('</ilayer>')
) {; [5 k0 L- |}' I) K2 Y- _# Z- q
document.write('</td></table>')
1 x! W9 ^4 f0 `5 A( |2 h& H3 n}& S/ m5 |; w# F
}
% g) o+ n7 ^) r: X% B</script> |
|