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

|
网页之跑马灯文字特效
//修改宽度
4 z% y# Y: K' Pvar marqueewidth=300
- S, V' W: Q; a- I! C. a0 j7 \9 N//高度. Z$ E- L" G$ J) ~
var marqueeheight=25
# u4 Z0 `( ]/ p- v: C//速度(1-10)
3 z8 q. [8 t8 cvar marqueespeed=3
' c' ^" D2 R. x6 U( n1 N% H ]7 \//背景颜色6 w: d6 u+ W5 I0 s( A: v
var marqueebgcolor="#FFFFFF"+ z! ^7 L: i V
//是否能暂停 (0=no. 1=yes)?/ `( q) `+ u% L k# U+ e' h9 M
var pauseit=1
, X/ r% A: @) u( e1 R0 v1 p7 w6 M9 @! s
//修改显示内容
" ?* l( e' v: u6 h4 i! g) Wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ |0 [2 Y2 I# g" b) T; [
5 x! ~' k5 m. v
7 E$ v$ h# F* j1 s* O2 G5 ?6 t% |- i////下面不需改变////////////
! O9 C. A2 c6 F9 s
0 w5 x' K" h- G+ I7 O- hvar copyspeed=marqueespeed2 _$ {6 {6 m: Q1 Y/ C6 d8 [. w/ f
var pausespeed=(pauseit==0)? copyspeed: 0
$ k7 e! h; Z* I( `var iedom=document.all||document.getElementById" A) q3 T7 m( n
if (iedom)
+ h9 P; \$ s& Y9 S, ?& @3 L2 G: Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# S( I# ]: r3 m S+ ^. n a; e
var actualwidth=''/ K8 {8 O1 y% A6 B- l* Z; S
var cross_marquee, ns_marquee1 b6 G1 O2 [! H+ _
2 K! A3 ~" J& r1 x z
function populate(){
$ F3 S, F9 `& N1 {2 m) P6 Wif (iedom){& E; `# O0 }, ^% A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& l5 G& g' U4 C1 G/ y3 ocross_marquee.style.left=marqueewidth+8; [$ J* u9 m E8 Y
cross_marquee.innerHTML=marqueecontent
% n4 w* D3 |/ E! Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& _ ? v7 t" A* T, V. R$ \* ]}
! c0 u! r$ T1 velse if (document.layers){9 v' }% A2 t1 x
ns_marquee=document.ns_marquee.document.ns_marquee2
8 Z0 S& B+ S& {* X/ `1 ?" r% ins_marquee.left=marqueewidth+8! ?9 n2 m: V2 x& l% a9 k
ns_marquee.document.write(marqueecontent)/ ]4 Z' D: s( U) R1 l3 W
ns_marquee.document.close()% P( r ?9 ^% {" [* `! c
actualwidth=ns_marquee.document.width( Z( B }( \$ ~- c& J, Q
}
. X- s% y; `% Q; k8 }lefttime=setInterval("scrollmarquee()",20)2 g/ p0 q5 x9 f! @) h
}! O% S! E- {" y: z1 x
window.onload=populate; {7 p& y, Y- r# k2 w) W
. p# u+ X0 c& _function scrollmarquee(){) Z' g( x+ M; y
if (iedom){
7 a( S/ D$ P- ?8 hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# ~/ n2 \( Z8 v, Q9 z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 ~& T# A1 `8 V' t/ q; G' @else
+ L. g" {8 z' p3 j& pcross_marquee.style.left=marqueewidth+8
! F* ]% `2 q) |; `8 X; r) i ~1 V" p$ [% q
}# @1 G/ N: p2 P5 D( \1 f# h
else if (document.layers){- P8 b& { h" F
if (ns_marquee.left>(actualwidth*(-1)+8))- A, Q" c1 R0 q' E
ns_marquee.left-=copyspeed
1 U9 }" M/ n- L- oelse# | j* g) v$ _7 n( Z; L( t. a8 K
ns_marquee.left=marqueewidth+86 V/ m; p) ^- X5 Q/ G
}
4 z% g% @/ T2 ?1 A0 ?}) ^4 Z- z! S9 @5 b
2 z: w0 @7 Z; @7 c! M
if (iedom||document.layers){
* a# ], X# ^9 H4 A+ pwith (document){4 a I* N" W8 n
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 t9 h( L: P/ y* ~% X! q
if (iedom){
0 T1 J. R M e; R& J7 G) `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 m" F0 v8 A+ m/ _8 Y% b2 K \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) i4 r- }! l( L- C5 q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 f" `, V# ^2 }) f& O2 U" V
write('</div>')
0 @+ W6 N& ]/ ?. C% o1 v}
P7 ], G" y! p5 \# m8 G8 s& Helse if (document.layers){* y9 s3 W2 o/ z% K! o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ i. E3 M5 i5 o, n; @% M/ n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. @- M$ P8 m! p8 l1 awrite('</ilayer>')) d* S R; A; H) k
}, I* _' x/ ]/ X7 C" f' l+ I* j; U
document.write('</td></table>')% X% G; u2 [. j
}) _1 c- M$ V8 D6 b3 P b
}* ~1 S3 u& F% G. }, b+ a$ C1 ]
</script> |
|