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

|
网页之跑马灯文字特效
//修改宽度: }$ h7 ^) x Z) U+ l
var marqueewidth=300
2 T/ k0 n: |! H- u: L//高度
\# N2 b E; k. r! {, ovar marqueeheight=250 C! W n3 |( N' W9 Y
//速度(1-10)6 x" R! q/ [9 Q8 K% X+ _
var marqueespeed=3/ d% _, ^& x! U; }
//背景颜色: x4 [5 W$ D x4 r: U) b( |
var marqueebgcolor="#FFFFFF"
2 D* C1 q# ]/ A//是否能暂停 (0=no. 1=yes)?
2 P* x5 J% @" d+ o: f, ~var pauseit=1
; u6 L1 u8 Q0 c" b9 ~9 G( k! I+ T2 a
//修改显示内容
3 P5 B7 h4 z. m* p- ~7 x% V2 Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 J/ L7 c( _+ O" _/ y. G
* G% Z& U( B8 E% A8 M# }
, G- [6 M8 _0 R////下面不需改变////////////5 ?6 l* T& B( w7 i0 j( r1 o9 e
3 f; T+ W! @6 s r8 D8 dvar copyspeed=marqueespeed+ g" s5 g* g9 z& l
var pausespeed=(pauseit==0)? copyspeed: 0
/ j" c6 J! f0 X& z. tvar iedom=document.all||document.getElementById
! Z1 P% C1 L yif (iedom) E, T! E9 e' ?- y$ N1 T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 Y% |; n0 @1 ~/ [, M
var actualwidth=''
" u( g8 G! h& ~9 f8 u! y/ O Jvar cross_marquee, ns_marquee( A3 c, d0 ~1 c& a! c( I
& _" a" Q( n7 \- t Ofunction populate(){
) ~4 Z% L% A' R- e+ N+ v: aif (iedom){
' `) U8 O2 b( x% O. F2 Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' Z4 U3 Q( I+ K, z- A4 mcross_marquee.style.left=marqueewidth+8
& d! l$ ]: x4 Y' L8 c. T# }+ ?5 Kcross_marquee.innerHTML=marqueecontent
! ?, B. M0 V& m0 E8 O3 h: Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 b0 t8 d7 r: f' V+ n; a
}9 J4 U) x0 @. Z* e/ q
else if (document.layers){/ j( V: t2 x( D1 c- b; E! H
ns_marquee=document.ns_marquee.document.ns_marquee2* V3 j a% H4 @9 E# T) z# H
ns_marquee.left=marqueewidth+8* g; Z( G9 L" D/ U- C
ns_marquee.document.write(marqueecontent)
! k/ z' F. r" T; xns_marquee.document.close()/ B+ i% K0 z/ o3 \: |. p( I
actualwidth=ns_marquee.document.width
8 E( Z7 b+ V- U}
2 }3 E5 i. v3 ?& N2 k& }lefttime=setInterval("scrollmarquee()",20)6 X. m4 b* ] L7 T, n6 A5 N. }
}
" u4 ?$ d5 r$ x7 [window.onload=populate
9 I2 B2 b2 F8 c6 H& U
8 v; U+ @) X' w: {( v0 Bfunction scrollmarquee(){9 o' h5 _4 [% k; a9 }: k5 W. y0 ^
if (iedom){- m3 [8 ^; Z3 C8 D+ Q" T% W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 D3 |# t. |# A1 f% `" j- }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ W4 s2 @, i/ t0 x8 {, W' G. H& ^else
# V4 d; l! z8 x* }$ ~ ?6 Gcross_marquee.style.left=marqueewidth+8
+ S a2 M5 e) H! F% c" Z) s* g( y0 s8 p0 e$ H/ V
}% x- X' }9 q+ r$ O
else if (document.layers){0 w" w @7 V, s; a
if (ns_marquee.left>(actualwidth*(-1)+8))2 ]3 r% _9 k1 t: P% v
ns_marquee.left-=copyspeed6 r% g3 W0 L D2 |
else
& O6 ~+ a: u7 p8 Uns_marquee.left=marqueewidth+84 R! Q) f" c' b6 ?, I* G
}& ^6 x$ u: w* }8 Q' M
}! ~# W7 A( S; s9 g% O
~5 |) J/ r3 l. m& }1 Z+ @if (iedom||document.layers){
9 O! U* F) |1 awith (document){
) ^! V' `* P9 o% A- j, rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 l; T- ?6 B7 m) z' T6 u2 Nif (iedom){
2 t) S% `& k' u+ B. }8 H, Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 D; U6 J2 V0 ]4 b( w) D, awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 F, T6 K+ d' C1 s+ u. Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 @, r0 r r- c% awrite('</div>')
- r' E( x8 R; \# d% ^}
& V J' T; \7 N! t* p) U$ celse if (document.layers){$ f6 k/ m1 l. N- b' }) j+ e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; f0 C1 F( H! @, O. Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# y( u7 f4 U" S" W6 ?) y9 M* wwrite('</ilayer>')
2 o- H# q' c. v9 b}
: ?0 n, H! T& N0 s% X) ?document.write('</td></table>')0 |! W8 p% f4 T; T! a
}% W7 l& w; W& o9 V: I
} q' R2 C/ k: a, _3 Y7 a Q% T8 \ B
</script> |
|