返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 e8 I2 x* A1 i  X
var marqueewidth=300
0 t! M7 w6 @; E' `/ U$ C$ K1 N3 r//高度9 T- l- H% |% A
var marqueeheight=25
. U. S! G& q+ x7 d//速度(1-10)7 w( b: P" Z/ j# \. t
var marqueespeed=3/ q: R7 r3 B$ L% a# i3 }$ m% ]
//背景颜色
! w* B* W0 y3 ~% T1 n( mvar marqueebgcolor="#FFFFFF"
  y! H; v: `8 e7 r  v' t7 y//是否能暂停 (0=no. 1=yes)?3 S" Q% x3 ?1 M' d$ n" U8 b, F* V
var pauseit=1
! r; P( B* B, M7 L4 a# p
/ o) N8 {$ }+ ^4 Q//修改显示内容5 ~- y! }( |2 Q; r5 m' r& x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 U, @" U" Y( `) b4 }
# o' ]2 ^+ `2 S: }" V# H$ q7 L0 Y' T; q+ x: e: k
////下面不需改变////////////6 k$ A, N# p6 c
& n1 d% K$ d* [: r. C7 w
var copyspeed=marqueespeed
) d, M" w% R& ?0 b" ]) N+ t, jvar pausespeed=(pauseit==0)? copyspeed: 0
! W2 {# U2 @, v( e& |var iedom=document.all||document.getElementById9 Y* m% y! f' Q8 l
if (iedom)
2 ^2 ~8 ^# I6 Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' Q0 q6 G% O/ b: i, |& ~3 j7 D
var actualwidth=''5 l& w0 a# J: M* a
var cross_marquee, ns_marquee
8 L  j& t! ]3 J. k* I) \
, {0 q( F7 S& V# z2 Tfunction populate(){
5 l0 H( W$ U2 r$ mif (iedom){  o* c8 Y! b$ ~# L0 o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ x  q8 e' o$ _/ G' j3 P" N
cross_marquee.style.left=marqueewidth+84 ~' V9 ~6 [$ Q8 D- J
cross_marquee.innerHTML=marqueecontent) d- V8 t: c5 `" ]' ^" d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: B+ K* y) k: w2 d0 {
}
8 M  A! ~! Q; aelse if (document.layers){, ?( n# D6 w3 ?4 A- Y& ]  T8 y
ns_marquee=document.ns_marquee.document.ns_marquee23 v' v( n: [$ b5 v/ N
ns_marquee.left=marqueewidth+8
) a3 _- Q$ ]  y# Z! ~" N( rns_marquee.document.write(marqueecontent); J5 T! F  W6 H0 _# E
ns_marquee.document.close()+ B; ~8 |" P, b9 M7 A' O
actualwidth=ns_marquee.document.width  q2 ?3 j) |8 X# c* W
}( h+ ?* l9 n* K
lefttime=setInterval("scrollmarquee()",20)! Y2 ?4 n$ e7 P# o6 e" F: @2 K! u
}0 A. c2 {+ c3 X2 Y0 F& w" A9 j( D
window.onload=populate* _5 h/ z) z' u9 Z. k7 U, B
# n1 @0 j. p, b, D0 L
function scrollmarquee(){& Z+ l' q1 y5 |# B3 {
if (iedom){& Q2 ~; Y! O! W6 H8 K- E" a; G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; c2 q+ o! Z, b" ?' C. z+ V5 ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ q9 i" g4 z) x' f3 E
else
& X. Q9 g% t& S# _+ x# hcross_marquee.style.left=marqueewidth+8
3 r9 ^& d7 @  M5 O0 B, l  X( t0 b1 u6 D/ }: n3 f1 I( A
}
5 ^/ S% d' W! X$ f  {else if (document.layers){" H, P1 |! z, T$ }
if (ns_marquee.left>(actualwidth*(-1)+8))
7 r8 G* J! I% G  c6 f- fns_marquee.left-=copyspeed+ t; L( B' F! x# I9 [* P
else! g; M* p1 u4 O8 }1 z) v5 y# F. {
ns_marquee.left=marqueewidth+8
4 @+ u2 d! Y6 L. N' R' c- ^}
( G9 H! `+ ~, m3 s}  X; \% R2 D  @

% B+ a8 x  J; I7 [! I: nif (iedom||document.layers){3 n1 l2 [/ s) i
with (document){: I) ~' O. R. B+ l3 h* O% k$ W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ p2 N' i4 F/ O; uif (iedom){8 \; {  G8 K! s% Q1 d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 ]3 C' G! C. X) y5 A9 {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' w6 P/ v' k% j7 bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( ]- \' j2 ~: Q7 y
write('</div>')
% W, B. C( [- U/ v7 ~}* X6 y6 T" z, f* W& W5 l
else if (document.layers){: s# u% \( U2 p# J9 l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) X! z/ E  Z% |0 r; iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* k  k7 `3 w- ~
write('</ilayer>')" O' V% E: a8 h3 ^
}
" r. J: w; O& X. B' G& ]document.write('</td></table>')& ]; g' q- w2 b! ^
}! j5 H! G; Q. T1 M6 v/ L
}" m" c% S% Y' k
</script>

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