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

|
网页之跑马灯文字特效
//修改宽度
, e* F7 }+ M9 J) \# L9 Nvar marqueewidth=300
, ], L; T) p& L+ A" u, C//高度4 O- p! J; Y$ ]5 W
var marqueeheight=258 F$ c% j9 ?6 }4 M
//速度(1-10)
/ a' M% S2 c4 {& L bvar marqueespeed=3
# B) [6 r9 Z4 f//背景颜色
; \ p0 P& \; evar marqueebgcolor="#FFFFFF"2 D2 M2 ~4 r0 _+ K7 g
//是否能暂停 (0=no. 1=yes)? f) E! F2 Z% P7 ]# r
var pauseit=1 [: g& ~' x! p& O
6 S0 H3 Q1 F! e; ?
//修改显示内容& w1 V, ^' d0 s0 M; h7 i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ m1 f4 o! x+ M$ g
, Z& ]; Y8 Y' i9 M2 O
6 k1 I# G# z* i# G////下面不需改变////////////
4 ^% V4 p/ X6 S% ~' }$ V$ S( {- s- ]& x$ q& J+ Y
var copyspeed=marqueespeed W8 v/ R5 ^8 a7 W$ V8 j$ W4 x7 s
var pausespeed=(pauseit==0)? copyspeed: 08 p# p& k2 q6 d. S7 v1 q4 w
var iedom=document.all||document.getElementById$ w3 ~6 f8 n3 K+ C* j
if (iedom)0 r1 Q. {6 X) e9 S& P3 I S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 r: G6 K9 H4 I: S, Vvar actualwidth=''
' r. o1 _+ b1 t5 E7 o) Xvar cross_marquee, ns_marquee3 O9 x6 |# F8 Z) X! W+ t
) D6 d$ b$ o' V7 f4 G4 {function populate(){
& L# g3 W3 `% d' T* F$ Eif (iedom){
4 \+ B) q4 g3 u) U2 ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 E" U- v4 C. j* t$ A3 E, Ncross_marquee.style.left=marqueewidth+8
0 o3 s# {5 p9 { l( [ C* g' Z! c0 across_marquee.innerHTML=marqueecontent
$ s3 w3 Z% {2 w% i' `% l% {; lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 s1 Y$ X# O+ G7 ~}
& t; m0 \5 a+ v+ }else if (document.layers){
. b) I# ~5 i+ G4 p1 y+ S3 C X8 Vns_marquee=document.ns_marquee.document.ns_marquee2
' P% ~$ g! C/ x5 ^3 b/ z- ^8 i: _ns_marquee.left=marqueewidth+8& i1 c& U. `* k: p% b
ns_marquee.document.write(marqueecontent)5 u. s$ j) z5 e; e4 j
ns_marquee.document.close()
5 `0 w0 V3 l, `) g: y& Aactualwidth=ns_marquee.document.width
X. I$ T4 k3 S; f/ h}
- v& Z. s, }7 w2 }lefttime=setInterval("scrollmarquee()",20)
7 Z: V! h4 ~. M: a- B/ _: h}
. b4 a4 H' U+ f! kwindow.onload=populate
9 W" G8 b" S" G2 d
. ]) r: T: s$ {) V/ D5 efunction scrollmarquee(){
0 S) c# d9 ?; gif (iedom){
$ U- A# n, [7 \, o, n7 N: ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) x. R% v* V) ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 y M# v' `2 s
else* U& B8 s4 S4 |2 h1 @
cross_marquee.style.left=marqueewidth+86 F; ^2 j, m- ] a0 m
! ^( K3 G* ^, t( A: _. B0 b
}- x: o% ?" T1 T- X! j
else if (document.layers){& w, ~' C9 ]& v" z" N1 E) t5 w
if (ns_marquee.left>(actualwidth*(-1)+8))
0 M! x/ Z' s) k& f9 rns_marquee.left-=copyspeed
( }7 v6 j4 {+ X: V) ]else' o; J2 s) C0 ^: ]4 _/ M
ns_marquee.left=marqueewidth+8
& Z3 G# f o* N" j4 B- ?}
) V% l" l% I9 E ~# @) W}& p! Q0 d) n+ D3 W$ C! S
# g' Q$ C# l3 ^+ x
if (iedom||document.layers){& \8 D, U6 \4 U4 @% n! V
with (document){
; m! q! A3 i+ Q- A* l3 Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% c2 L3 U' q2 C5 Kif (iedom){% B+ J" O# o4 w: x3 _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 u+ O( i; B9 c; t$ {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, D Z1 J; p% j( }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 `; a) K8 C. ~1 u; `, o' Vwrite('</div>')7 u' e! P8 p- R4 e/ c
}
0 ~' V5 t: f# F4 E/ Z gelse if (document.layers){1 G4 v V) J- d: [: q' W* S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& @, b# W4 I0 ^
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 s: e. m0 h+ |: _- owrite('</ilayer>')0 n8 t- ^4 r+ A! a
}) K( {8 @4 H% {: F; S
document.write('</td></table>')
" K% R/ v q* { `$ ~# N}
4 G3 Y5 `. p$ L8 K M}
/ a9 S* ^) B5 b7 ]7 y. Y</script> |
|