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

|
网页之跑马灯文字特效
//修改宽度$ f/ ^. q5 F, \: l4 Z) ^
var marqueewidth=300
" m) B5 {( _* W- E//高度
7 N8 }7 d. o2 k% [; ~, C9 Kvar marqueeheight=25
6 M& \* t* m: v. I9 u! q2 W//速度(1-10)
- F3 R9 r: b; y3 Lvar marqueespeed=32 g+ J; R, K# C' h# R a9 k
//背景颜色
" ?" I, _' D" Q- d3 Evar marqueebgcolor="#FFFFFF"
9 i9 @& g1 [4 Q- U% r//是否能暂停 (0=no. 1=yes)?
6 W" J% f& i8 }: t$ E$ \: ovar pauseit=1# h* D3 I2 i0 K& V/ |( h% ]# U
/ }' l7 B$ \- X
//修改显示内容
4 e& G9 j. \# ^( i* e; xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 w) _5 v2 ~( ^; {/ s2 q
$ S8 ~0 e q. D# t' A L, d) E) @7 Y6 e" a7 o+ v0 _6 j8 U& l3 e+ \
////下面不需改变////////////
7 h5 D) n( L4 C! D. s/ h- s. w# I, w3 W9 R
var copyspeed=marqueespeed
1 x! g7 x" g7 Z5 s/ o9 Evar pausespeed=(pauseit==0)? copyspeed: 0
# F+ k0 \5 ~) z9 K( Evar iedom=document.all||document.getElementById- a2 U) |, }# F4 q. S; Z/ W
if (iedom)
8 y! u) A5 t; \" r7 ~/ X' |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- ^ r5 ?2 L+ h- w& h4 _
var actualwidth=''3 @! e# c3 n& U0 e( k- P2 J' L$ \
var cross_marquee, ns_marquee) Z& E1 c4 q: c6 h3 A2 n$ H, r
9 {) q- }' Z2 v6 w" b, lfunction populate(){7 x) W |( G3 l8 _
if (iedom){
$ p9 e1 C5 O9 F5 U; @9 @0 K2 mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ q: Z; h" N- R: g8 F; s
cross_marquee.style.left=marqueewidth+8
8 G ^4 o1 z8 pcross_marquee.innerHTML=marqueecontent
0 b- c3 _) K% }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: j2 t6 u3 V. K% R5 E
}
6 u* n! Z( D: I& P- _5 Celse if (document.layers){
2 w- i, Q9 A( H9 p; ]/ G; V( d- Hns_marquee=document.ns_marquee.document.ns_marquee2
, |: l. `# T! d" [/ O) y4 T/ ]ns_marquee.left=marqueewidth+81 i4 [# {& k% B( S
ns_marquee.document.write(marqueecontent)
6 h+ F( D% }$ r6 a7 u# kns_marquee.document.close()
0 D7 ]" Q6 w1 U3 o6 xactualwidth=ns_marquee.document.width/ R2 S6 W+ ~$ }# Q# o
}
# D+ o i1 m) p' C- Qlefttime=setInterval("scrollmarquee()",20)
7 L' n; \% J7 Z5 P, `: R( u}% h" K3 w& ?: T+ Q$ \ u
window.onload=populate
; F# N1 U: \+ g+ z ]# j
: M) f9 ~" G5 ?6 ~function scrollmarquee(){7 A# q' v7 H% w4 k8 P! W
if (iedom){* D. g2 _, v* U! ]" w- x* d' G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 V4 \+ W2 ~$ _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 X: P8 w" p/ |: k0 `% a
else) T: y3 j6 P& n
cross_marquee.style.left=marqueewidth+8
7 |" l8 q; y- d% k7 P; A/ t9 D8 @' g- n; L- S6 h
}
; T- \6 I. ~7 V2 r% N" [else if (document.layers){- r+ |4 d4 d# j$ z9 g' e
if (ns_marquee.left>(actualwidth*(-1)+8))3 M6 f7 S6 N3 q3 V; K! G
ns_marquee.left-=copyspeed" x9 A) Y' f; `9 z9 Z% {
else
$ j: a1 v# e1 X9 {6 ]$ i# k9 F( Mns_marquee.left=marqueewidth+8
, M% v6 s% o" Q% o# ?" P}# e& C4 |# F' t8 B; S0 N
}
6 Q/ x. L ^# T$ c
9 I7 _; S2 v5 \) ^: n' Z& g. C; |if (iedom||document.layers){( ?# x! _' s- u5 b/ o; O/ `3 m& d
with (document){% n3 ^, n( {! N! r" j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 I9 n# t) t1 S, U+ T( p& ]
if (iedom){
; H, Z; q3 R0 p u, U# L4 {8 Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): c+ ^) t' T( q4 W8 _7 n! q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- u8 t( N9 N! O: N4 ~2 E# R% u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ g+ r% j1 A( a/ b% ]9 L' ]( Z: ~write('</div>')" J: Y! A- o9 z* R5 k
}
- f Y+ J& R7 z" f0 A& J, f! o- }( [4 `: telse if (document.layers){4 G4 T, p7 M; A; K- H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). z. R$ r6 t. e2 Y* L. X8 b4 ^1 o
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# U/ ]. Q5 k7 o% H) ]
write('</ilayer>')
# X. ~! I' X- k( `( V}
; G, W+ ^( C6 g$ F7 J: n% edocument.write('</td></table>')
3 f0 a& P5 r, m! _4 j8 k}
) P- h% |6 F, g7 @7 {5 [}
+ F2 }9 c, n' P& ]$ E</script> |
|