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

|
网页之跑马灯文字特效
//修改宽度
# H$ T$ y' H' j5 x9 m, G, h3 avar marqueewidth=300
+ b3 V) x. J: ]* p2 A- C0 z//高度$ x, d c: S4 X* K4 B
var marqueeheight=25+ O; [- d9 a [$ J0 L
//速度(1-10)
4 ~( ^: n: `7 d0 z) c0 p2 nvar marqueespeed=32 @9 a5 ?0 A5 R9 x+ T, r; V9 ~$ @
//背景颜色; ? M, e6 Y8 ~, `1 V
var marqueebgcolor="#FFFFFF"
3 a8 V6 e6 b) I, O+ s4 Y//是否能暂停 (0=no. 1=yes)?2 t* k8 o2 S4 i# ?
var pauseit=1
, p9 F, ?* h: I( \* l7 e- H6 p( L4 u
//修改显示内容2 K9 q; r* N( g5 y& b0 z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' p# f& \# H( u- ?2 [4 S$ d: \' r# m, F! x% h% j
# l4 l+ l7 ~ Q. x* S! s% w////下面不需改变////////////
! S+ i9 H' C) f) c6 i4 i* Y0 {9 F" ^
var copyspeed=marqueespeed
$ R( p* |6 v: R6 k0 A% h! ivar pausespeed=(pauseit==0)? copyspeed: 0
! f/ B R" r" ^var iedom=document.all||document.getElementById
9 a$ @/ Y- _' W3 J7 o2 `if (iedom)
1 s) F ?% u9 X2 {+ V% udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& n$ k1 s0 v8 Gvar actualwidth=''
6 d( | K0 x7 i3 X1 Gvar cross_marquee, ns_marquee4 Q; g$ T" @7 C4 c1 U- F
- a$ L/ G T7 [: ^function populate(){, ?5 H9 i4 u$ J0 \ _+ u0 ]7 F9 k
if (iedom){% O! T7 o- H4 y# i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 F' }5 }! S. J3 [# g, S7 g# b
cross_marquee.style.left=marqueewidth+8; @# n; e2 R. P! U1 T( Y) ~
cross_marquee.innerHTML=marqueecontent* Y+ _- L2 a E! b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ p ?& w6 O: a4 r3 N! @
}
; B8 d1 h1 @0 |# J6 V7 P, O5 melse if (document.layers){* F% Y9 X2 S( v5 M# n
ns_marquee=document.ns_marquee.document.ns_marquee26 {+ C4 H4 D6 b u1 i/ w/ c
ns_marquee.left=marqueewidth+8
3 x: V4 @ i3 j- Fns_marquee.document.write(marqueecontent)
D3 Q; r& h; P' m2 fns_marquee.document.close()* u% F% Z% g. d; q4 j' u
actualwidth=ns_marquee.document.width/ f) k. Y9 C6 i1 F$ q& f3 ~% M* H) r
}1 h1 |% l1 t, G
lefttime=setInterval("scrollmarquee()",20)2 x+ N" ]; O( `, C+ n* g; G
}
1 L3 l3 a9 ?$ I/ M* x5 Lwindow.onload=populate
" z! e# j8 |( n0 l7 a7 |
" A/ _. w, ~, }5 z u" a1 N0 gfunction scrollmarquee(){
3 F, a# V4 E+ ]2 l8 k( [/ Gif (iedom){
2 N) u6 k3 _# m0 J* \ l$ Iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) m8 v. G+ Q6 t5 tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: T5 y2 ?1 M; y1 B8 o7 h- S
else
* l5 K t% j) R g; G' ~' Xcross_marquee.style.left=marqueewidth+8. P+ X. l- C) m# w$ X* k( r
* `" x1 @9 ?- J1 t9 i* N( T
}
& A4 s0 \ c6 v @5 J) p) [3 Welse if (document.layers){
! _) A l8 e% D8 z3 x# z) sif (ns_marquee.left>(actualwidth*(-1)+8))
b$ J- l& f ^, v2 H$ _ns_marquee.left-=copyspeed: `4 U K! u" x- J( S2 u
else
- ~6 l- a2 m2 \6 L8 rns_marquee.left=marqueewidth+8
, g. t# H; O7 Z( z: d}' V5 {* w! F4 V; ?
}
: I1 F; W2 m, Z+ I/ }& Z A5 _7 ^) C2 J, M& K
if (iedom||document.layers){0 g5 }. M+ l$ |+ g! c
with (document){
$ t+ r- j0 l9 ]! udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' D; O6 u( S1 }4 }
if (iedom){) M8 G9 \* [! q4 Q6 A
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 c& d6 f# j; s9 J6 k/ x1 Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- F+ o# o; _8 L4 X# W# F
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 {8 D) z" X5 H" Cwrite('</div>')
* N' x, C+ Q* J9 b- i}' `7 D9 L- x" j6 K
else if (document.layers){ O9 |( }0 F5 `6 s8 ]- P1 k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): i7 l+ R8 r$ U9 }; ^- \9 b& ^, |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' P& G, a* y! I/ N- E. F
write('</ilayer>')1 L7 G% o; D0 c! ] v* I
}
1 p) @0 A4 H; }& Y4 |: [! bdocument.write('</td></table>')
, D, A8 ?& _. y! n1 T" s) S}- l8 B, M! O0 f, H, p; f) w7 I
}- W: h( A$ b" V9 `- X$ _4 u- \
</script> |
|