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

|
网页之跑马灯文字特效
//修改宽度
! J% _$ ]9 D. `) c2 @9 tvar marqueewidth=300
$ Z8 d+ V; s+ H7 |6 N//高度$ i1 A" U1 C3 z# Q
var marqueeheight=25& R$ k* U- p( ~+ }8 i
//速度(1-10); L* i6 ?6 N3 ]2 W/ s8 u
var marqueespeed=3 P0 N( H @3 T
//背景颜色
6 z$ K) T, s6 R" v. Uvar marqueebgcolor="#FFFFFF"+ P/ k1 i0 w8 V$ y% x' d0 c
//是否能暂停 (0=no. 1=yes)?! q# ]: R" u9 D* G
var pauseit=1
, c) l( p( K/ P" g( L! i a
, L! J r, x: d2 }8 A, Y: t2 [//修改显示内容
) Z+ f* V# `9 f% F: \var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( z3 F! e. J9 K4 H2 K( l8 E5 t
- B+ b! c+ K6 f! y. o* e6 L/ O
; ]) T" h: o( \# x7 w
////下面不需改变////////////
6 H& ?+ W: W# U( `1 Z; q' u
# r$ B9 X0 {2 W- H- v' ]1 evar copyspeed=marqueespeed9 E' o! l8 O' d4 q0 f: W _
var pausespeed=(pauseit==0)? copyspeed: 0
. L" n8 R4 _2 T, ~var iedom=document.all||document.getElementById/ E* ~& Q8 {; @3 i8 q5 @
if (iedom)
# }# u8 n9 u( r- `( K; Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') v( H# g' J4 _$ Q
var actualwidth=''+ |' O7 B0 D6 v! F- v* I! \
var cross_marquee, ns_marquee
3 s% G! C( s% D( @0 W
9 X9 S, f$ Q# H* h4 c( D* Nfunction populate(){+ `; z) R" p; n( V9 K
if (iedom){; X) T6 c, x* [5 Y3 z K. j. ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ E1 o# O- g4 f
cross_marquee.style.left=marqueewidth+8; \% b* H0 k5 Z6 ]5 K4 T$ b2 w/ M
cross_marquee.innerHTML=marqueecontent" L' Y, O: Y0 r, H: i
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, L* w( {( t `9 j. `0 ]
}
) L2 m4 l, K1 V* v: \1 delse if (document.layers){/ d' ?. [4 R1 H) d
ns_marquee=document.ns_marquee.document.ns_marquee2
2 y+ r0 ?3 a+ E! {( f3 q$ A; ?" xns_marquee.left=marqueewidth+8+ X8 g. b6 N. v. P- H0 O
ns_marquee.document.write(marqueecontent)7 s0 @& ^' X: e8 {5 U4 r1 R
ns_marquee.document.close()
! a% u( O @" `actualwidth=ns_marquee.document.width Z6 C0 j6 g4 ?+ |" D3 l
}1 n% m6 h: R" c$ I2 L
lefttime=setInterval("scrollmarquee()",20)8 |0 t: k- r3 p+ J p; v( t0 i
}8 P3 O6 t; [+ b- V7 u, M3 `
window.onload=populate
, D% k+ ?' m4 h( V# Z; n- j; u- @, k- V" C$ }) r7 ~' U
function scrollmarquee(){! K: ?) c9 ^0 a- e3 t7 O6 `
if (iedom){7 d2 ?! P! _9 _8 A3 O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! m' x5 U/ T/ s% T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 R. Z% C8 W+ I( i: U# K' Z
else
, `( w. b6 {* z: r/ Rcross_marquee.style.left=marqueewidth+85 E* j& \+ x8 N8 x; M
' z/ [4 G! v/ _$ n4 b
}! V4 p2 o; S) G5 z. }
else if (document.layers){( n0 u; J1 }- ~ ^( j& ~+ l4 K. s
if (ns_marquee.left>(actualwidth*(-1)+8)). k' F5 [0 @$ ^% J
ns_marquee.left-=copyspeed
2 F" h1 [' @5 b8 melse
& V$ B* l0 J- \ns_marquee.left=marqueewidth+8
1 @& P' J, q7 h8 L}
) Q: A1 @) Q3 A% [}
6 Z6 x; W0 O5 ?2 G- N$ \; H) W9 E6 ]% j! R/ Q
if (iedom||document.layers){( {2 t/ T/ d" [' _: ^+ O9 C
with (document){( V: [: w0 o9 ^0 J1 u
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 _! P/ R; @% ?9 X, d o! fif (iedom){0 y1 y3 ?6 O. K3 ]9 i
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') v/ }& M' G0 C- f" A* g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 K4 U7 i; D% T4 H5 ^$ ?
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 Q5 `9 U1 ?9 x. U7 o- J
write('</div>')
# z( f3 q. Y* @% f}% f" v$ d1 ~# Y
else if (document.layers){# l) d/ \+ h E( @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* s& B+ w8 |% e* Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 ^, k: X2 H5 R7 s+ T* l$ Y K S
write('</ilayer>')
* D7 I* L8 m2 b$ s6 e. T}% J1 d8 a7 r2 ^ b O. f
document.write('</td></table>')
/ @8 u2 ~" N4 r}
) {0 D8 h C8 ], {}/ Q+ U' W9 I @% B, S
</script> |
|