获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- Q( D3 Z8 Q5 Z, d! Qvar marqueewidth=300
7 q% h' C" N8 s, j# P: A" D//高度$ E4 W- ~4 @! _3 L
var marqueeheight=25
/ c* C8 D: D1 J4 N2 `, O//速度(1-10)
2 ]  u( N3 @% q, h4 ivar marqueespeed=3$ P) H9 q4 q3 u# M4 Y& Y7 n
//背景颜色
, A( _( O5 D' R" ?8 Lvar marqueebgcolor="#FFFFFF"8 |" v4 J. E5 r3 e6 @/ @  p
//是否能暂停 (0=no. 1=yes)?
0 q% l% B8 o! h, A& {& Evar pauseit=12 K, b  i, l% K% Y5 ^
! U: m) q- z, |
//修改显示内容1 ]# ^9 w6 D# W3 A, K7 H# p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 g" f3 `6 ?7 G9 ^9 t8 a  E* M8 W. H1 ~" `: m7 J

$ Q5 V0 P# h- u& I6 V8 x; x6 {////下面不需改变////////////5 R' E$ A* X& U9 K( U8 k
9 c% Y1 T$ U! N4 q
var copyspeed=marqueespeed8 _( d4 |2 Z+ ]
var pausespeed=(pauseit==0)? copyspeed: 0, ?/ d- u% F$ c, U# E3 D
var iedom=document.all||document.getElementById
) H) s+ r  G! r( l6 Y! o! m9 ~if (iedom)
7 z! s" b! v" e+ P$ bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 y' ], R% s, G3 T1 _var actualwidth=''
4 z1 ~0 w8 q0 Q; kvar cross_marquee, ns_marquee
1 Q; ~- M8 I# J/ W5 v, D4 f8 m+ R8 \# Y, A2 ^
function populate(){( z3 o. y4 ^% ~3 @. u# Q' j% p) {0 i
if (iedom){
. |3 o9 Z( [- U5 icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. o  @0 J+ s4 ]9 ~3 C2 ]cross_marquee.style.left=marqueewidth+8! Z8 N( b0 |! u3 Q/ F
cross_marquee.innerHTML=marqueecontent1 w* M  l4 X/ n. _9 d! f
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% x0 {/ C. [( W% e9 j
}
) J: l: |( c4 V# v. w' K8 Yelse if (document.layers){1 V7 G2 H$ a9 i2 V" ~
ns_marquee=document.ns_marquee.document.ns_marquee2  c( y1 Z+ g! |
ns_marquee.left=marqueewidth+87 Z, A$ w  f3 [5 H' Q
ns_marquee.document.write(marqueecontent)/ O2 N. T0 V3 l' j2 Y' n
ns_marquee.document.close()# W: Q0 e$ f2 J* M* m6 ^7 p
actualwidth=ns_marquee.document.width
  A9 H0 ?9 \; [' @}
0 P) b- }$ d+ \# B4 p5 g( n1 g% e0 ylefttime=setInterval("scrollmarquee()",20)
5 U# `; E( l' D}' t" i8 H! J" }( s6 X
window.onload=populate
* ]1 z% x1 Z; e5 D' z8 ]' t
; Q3 T0 Y3 Z, `9 Kfunction scrollmarquee(){+ ]. k, J) C7 d5 e. z
if (iedom){8 p6 N3 j+ h0 F- b
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- P& W5 F$ q, Q( q* Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ b8 T$ k0 Z/ ?/ |else6 l2 ?8 }, Z/ y( [
cross_marquee.style.left=marqueewidth+8% a( E! \2 h4 s9 C0 |  ^0 \6 Y
, C3 {- Q$ [/ U. y
}' h9 B" B. X* E5 V! }+ M. H
else if (document.layers){
0 W# \: ~2 B8 Q6 o4 uif (ns_marquee.left>(actualwidth*(-1)+8))
8 b9 T7 P4 ]& s* J/ B/ a0 dns_marquee.left-=copyspeed( C7 O- ^8 H  p1 _: a
else
% {# ~/ k% T9 uns_marquee.left=marqueewidth+8
1 k* {* M! G* z- {, W6 B* X! T* U}
9 y8 ?; @0 q# t/ S- h0 r; _$ C* @}
+ ?4 P9 Q: _. ~1 d8 Z2 e, d
" V! c  }: I% `$ K" R: jif (iedom||document.layers){
0 q8 Z& i5 w/ U% w- B6 X/ f' w) owith (document){
& U6 p- g! [) e1 Z$ x/ p1 ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; ^: ~& b( u  u5 a* v7 K5 Bif (iedom){
+ r0 z8 R0 L: F9 ~8 w- s8 nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 ~9 h, H6 `# e% M
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 n& n# K2 H% z' F8 ~. owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, Z+ l) `- s5 pwrite('</div>')
% k/ c4 R; v( c+ W}! z! j( d, A  T+ T3 m8 T
else if (document.layers){
4 @, \2 A/ L% }7 a& C; j$ swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- c5 L2 J' x. r- F; _: t# `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& F) m$ P  K" p& g$ x8 y* Wwrite('</ilayer>')$ [! @5 j6 g9 ]1 U5 j
}
+ A$ O2 F6 D) F- D, F4 n/ Kdocument.write('</td></table>')
. k7 }; L- b8 j: `& X( \$ n}
) W3 K, l2 u& C) d$ ^- }}
# q% C0 Q8 |( p</script>

返回列表
【捌玖网络】已经运行: