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

|
网页之跑马灯文字特效
//修改宽度
) Q6 {: {5 @- i9 Rvar marqueewidth=300' n; G) R: y! p m8 n! \
//高度
{+ \9 L& A& ]1 n6 A, Pvar marqueeheight=25+ y- V: x% m ?6 Z, X' Y
//速度(1-10)) I& d; u! Z6 v7 j; \/ Z9 f: `
var marqueespeed=3/ X1 C: b4 p) K u% q; X' K- {
//背景颜色% ^+ ]3 S, X/ \
var marqueebgcolor="#FFFFFF"" B! P/ J. ~1 o% p r! W C
//是否能暂停 (0=no. 1=yes)?! y |3 c* \' |- z- A) }
var pauseit=1
% H' F- W& E5 S3 f9 D8 A6 t8 I! W; j; c6 ]! K
//修改显示内容" U% U9 i. T. y$ U2 F
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 W# x& x7 |" M5 j% E
7 h" k+ y! ^; f- i' z6 x: U
5 D% ]3 I& Y5 `( B* U# q////下面不需改变////////////2 g0 A- J( D/ B, o$ k+ w: s/ g
' S& j- G+ K) f0 x* I/ M
var copyspeed=marqueespeed
( F+ v+ v+ R3 |* C/ m5 T" q" {6 {( u$ Pvar pausespeed=(pauseit==0)? copyspeed: 0% O8 H* l( x: P& x/ e$ Y# B
var iedom=document.all||document.getElementById" c0 h# x( S- } D! q6 N
if (iedom)
; y6 `3 g% Z+ C. H: R" u( f8 \- tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): `8 Z( F9 l, e8 @
var actualwidth=''. ]7 I2 F; {& a* d; b
var cross_marquee, ns_marquee
# b3 k6 G9 x, `" M( n& {0 W3 Y4 N4 v5 _, r! k B- b3 Y
function populate(){
1 \( X+ x3 ]1 P. w, s0 Fif (iedom){( p& D+ L; Y3 m0 [& y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 J& H' ~0 k) P% [4 i2 Pcross_marquee.style.left=marqueewidth+8' y8 G4 e! ]& U( ?8 Y% L, C1 v
cross_marquee.innerHTML=marqueecontent+ T0 z" j$ |) b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 b' O3 u+ ^2 J4 t9 r}% t7 K+ a5 x2 M( Y0 b2 \* Y
else if (document.layers){2 j# _4 T9 l8 d! g: F6 I
ns_marquee=document.ns_marquee.document.ns_marquee2
y6 L" Z; N2 H- s8 Ens_marquee.left=marqueewidth+8
% j" g4 i2 Q G0 A' c N2 l8 Y) lns_marquee.document.write(marqueecontent)
3 W/ u7 c7 I0 Gns_marquee.document.close()
3 w1 l, m9 f# G- U8 ?1 I4 Sactualwidth=ns_marquee.document.width/ [; u' F# m9 U* H9 G" G
}
0 w( I6 L$ R* C' |& p& s: olefttime=setInterval("scrollmarquee()",20): J6 b i# ]3 H+ L# D3 h) Z
}
, ^6 T- ]2 S. O k' O& r5 ^# O; O6 }6 kwindow.onload=populate
2 }) G" }, n Z- F7 P: u! X, R- c" u# L: Z
function scrollmarquee(){
- Q* S5 ^# ~4 f4 g g* oif (iedom){
) Z, c: Q6 X& Tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); U. A d' c) W3 ] W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 A! X# p+ m# w/ s9 C. D; v
else2 a3 G. g8 G2 c4 r! I u
cross_marquee.style.left=marqueewidth+8& r( L0 y) n9 a3 m0 Y* y
* f7 d* Z0 ~/ s' \& D: @2 Y3 q
}( C6 E* E. Q3 D [- W
else if (document.layers){
$ J7 M) }0 v8 u; D2 cif (ns_marquee.left>(actualwidth*(-1)+8)) P7 U4 W: V0 c/ }, t
ns_marquee.left-=copyspeed
* `/ {& Z+ P5 \1 d" ?else
1 C3 @7 n" L% P6 v$ c" M5 sns_marquee.left=marqueewidth+8
9 v, o5 E f% ]/ B8 }/ ^- O2 H}
' j, }% |6 }9 T, R3 K# J}# _% W" A- h" N) ?- x
( j& I I, }5 X* U8 i% b ?) C
if (iedom||document.layers){5 a/ v& t8 Q1 G( e- S! b
with (document){2 b& y& t1 P9 @; \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" t* z {' o7 ?7 b2 Y
if (iedom){
& d( O& ?7 T! h1 _5 h% r3 A- x# Bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 t5 J& U1 N* ?0 swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! G* K% \8 ~) Z0 Q7 H6 v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' k& \) u; m! c. ?$ @/ T6 z/ qwrite('</div>')
. V. d( M* M5 z; f: _* O}
; b' o8 e- e- `else if (document.layers){6 u) q% r5 s& J: N6 S! V+ e; \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 z" ]) O3 s4 X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 b+ w* n$ C- Y' u, `
write('</ilayer>')
! {/ |7 U9 r5 z}
4 d4 j$ Z7 R+ f, n4 Ndocument.write('</td></table>')
0 |2 S6 R* A2 e& ?. y. R: n}$ i/ K U) r. V! P" @4 o
}
D) K! E$ ^- V- q) s, V</script> |
|