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

|
网页之跑马灯文字特效
//修改宽度' { {$ N: ~5 c+ c
var marqueewidth=300
+ x8 L7 B( {% u `% o, N//高度# j, C! z; K9 l
var marqueeheight=25
5 u! ]0 K7 E' A0 J. l: {//速度(1-10)* |( n0 D! G( @7 \. D6 L; L
var marqueespeed=3% P# \2 m# b1 C0 M; R8 G
//背景颜色
! ]3 B. i5 N7 \4 Nvar marqueebgcolor="#FFFFFF"
5 o- V$ v6 w* h. m/ Y& c# W" w4 S//是否能暂停 (0=no. 1=yes)?# X' \" n6 C) R7 P/ A Z
var pauseit=1
9 X8 n0 s6 b$ A( D3 N
6 R' t! z' H" z3 b//修改显示内容
/ k& e1 G1 l1 ^( m: l+ Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! h) H( Z4 L3 w* d
2 d' F+ T. M2 g! I7 S6 B5 G8 x$ q; M2 h& n4 r! q6 u
////下面不需改变////////////, b) A1 F/ S, t2 l" x% `8 h, {
2 u1 A7 i: W% z' q5 e, J
var copyspeed=marqueespeed
! `+ H% V: D7 H$ Ovar pausespeed=(pauseit==0)? copyspeed: 0. g$ y/ \4 s& j1 V
var iedom=document.all||document.getElementById! \6 O: V# J- e5 @
if (iedom)9 h, t; a' P+ w C( ]+ P/ q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 ? C6 X/ n7 C1 Hvar actualwidth=''
7 T; O* T. e; f! B) f; Dvar cross_marquee, ns_marquee8 Z" b; j% Z4 K& m5 `6 i
2 c `% j6 b. q3 Y: y# W* ?3 v1 Pfunction populate(){. a' |* J( R5 w4 p. W
if (iedom){
1 V6 s# U) l( S; c4 C) I* P# ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 g, K" L9 b# e) }( R! Pcross_marquee.style.left=marqueewidth+88 {! b- O) t5 L. \
cross_marquee.innerHTML=marqueecontent/ Y0 O/ @0 P7 G! b6 Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% B, S. F0 x/ C3 O- f9 ^
}# ?9 H0 l9 d1 C/ {/ i
else if (document.layers){
* z7 r5 H. ~1 R9 s" Rns_marquee=document.ns_marquee.document.ns_marquee2
g" M, v% E$ k* ?ns_marquee.left=marqueewidth+83 j8 |- X/ W' ~
ns_marquee.document.write(marqueecontent)
: a" Y" r8 G( Q, |( U6 u: }9 Rns_marquee.document.close()$ b* P- S6 P+ X' j7 t" r
actualwidth=ns_marquee.document.width5 v3 a$ I$ I! L8 Z' Y& e8 s
}
/ L$ ?! m( c8 F" |) D7 X: a# G; }lefttime=setInterval("scrollmarquee()",20)
9 o' v1 i8 h6 R! p* U8 M/ {# s/ D}
9 z- X# F* o, j# g/ \6 y4 {% n2 I& rwindow.onload=populate8 L* }( B6 ?8 C: i5 N
U' K3 @3 g7 J+ nfunction scrollmarquee(){
, [! ~- L+ b$ Cif (iedom){. e* X! k9 D& j: N8 L% z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 i' W& h7 U0 Z, O& u/ Qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% g: _2 j% f) T( _8 relse
7 t( ?; E* ^4 z7 j, [2 Fcross_marquee.style.left=marqueewidth+8
3 D! ^6 }& H) @- N# V
1 \% t, t: o! g: c+ R}/ ~6 p% S9 a, d6 n) W+ n
else if (document.layers){$ g7 l k# k- G, D
if (ns_marquee.left>(actualwidth*(-1)+8))
7 L9 e! L+ S2 t; zns_marquee.left-=copyspeed
3 l$ s" C2 [ y6 zelse
: n5 O7 Y4 Y8 F% K% Rns_marquee.left=marqueewidth+8
: q5 d5 y# w! V}8 ^% O9 t4 P! V
}' h, ^/ S! K0 X) M2 a0 _
+ S% U0 p" z( f1 R* oif (iedom||document.layers){1 i+ u. b5 ~7 p
with (document){
* G5 {: o0 i# p) Q1 M' b: S7 F' p7 Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ H1 V# }, c7 uif (iedom){: |" h" L. \" k) ~7 J3 z( }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): p$ D( j! O; A+ ^2 S
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 c( z. j6 ]& Z, s2 pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, F" C# @; ?6 \write('</div>')* a0 }/ G0 d; _1 p
}/ X9 d" ~# z. u+ K# @' E
else if (document.layers){- m. j- s+ g1 G4 Q% U u$ C. F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 w; e$ U! h# i6 I; T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 l: N* Y8 Q( X% \# m
write('</ilayer>'), O; P. e+ n Z* H6 a- k* y6 h
}% R$ E; J, ]/ A5 j# D6 {
document.write('</td></table>')+ K7 D5 G# j b
}
" [2 q% j* d5 W: {. r}7 t( V( s$ S$ b- P4 X3 c4 E, y
</script> |
|