返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 m. A) G1 a/ j0 Q/ C
var marqueewidth=300# I1 |) k$ Z, K- i& f3 p0 @
//高度$ @3 e$ M3 j* R
var marqueeheight=25
  J/ {" c' V6 x# L- p- H//速度(1-10)/ U" \; K: P# J: [5 H1 l
var marqueespeed=3% `( C) A6 V) k# ^9 T1 }3 Q
//背景颜色
* X  y) g9 ]# H9 @var marqueebgcolor="#FFFFFF"
/ k3 D; q8 k. R6 X//是否能暂停 (0=no. 1=yes)?% o( |- S' [! Q% B* s: s
var pauseit=1! D& x- Y# t' W; f
( j" W+ {  T4 y3 ?- M8 z
//修改显示内容
( w5 x% P9 ]8 v: gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! b1 ^& r2 v, A& B$ e$ u
0 l( W/ J' c* ^& z% G4 _2 o4 y& @0 v1 o# X! _. z
////下面不需改变////////////
0 o7 R) P$ p1 R0 g2 Y( A
3 `$ B  V! K6 K9 jvar copyspeed=marqueespeed/ v( l5 n" x& _
var pausespeed=(pauseit==0)? copyspeed: 0
" c4 @  g2 H( s0 |! J: P1 a- k) qvar iedom=document.all||document.getElementById4 R) g8 z0 J( W3 S
if (iedom)( {$ L, D$ t; e( w1 g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! O0 z" T/ e' f$ E9 ~
var actualwidth=''
) R. w' ?' f: \% f/ s" i( ~2 x$ d9 Svar cross_marquee, ns_marquee
5 p: ?) k" `1 }! T+ p+ l# L, m( Y3 v( @1 K; l* y0 {
function populate(){
) _3 ]1 g3 n0 d, uif (iedom){
  z7 g2 Q4 r6 lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( q  i9 z( q1 hcross_marquee.style.left=marqueewidth+8
7 D( J1 Y* W1 }$ p7 o8 r4 lcross_marquee.innerHTML=marqueecontent9 ]+ K* Z4 p& {2 F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 P# h3 n. a# H# ~5 o
}
4 l' h+ |1 {1 u: p8 felse if (document.layers){
# |; _3 }# y8 g/ `2 z. Fns_marquee=document.ns_marquee.document.ns_marquee2, H- I3 V6 v+ y7 m
ns_marquee.left=marqueewidth+8
% [( X: F) F4 o/ Jns_marquee.document.write(marqueecontent)5 V' L& q6 B1 g/ ~0 Y
ns_marquee.document.close()
6 R, a: ?# d( S8 k$ M) h7 G1 m* ^actualwidth=ns_marquee.document.width  t& l3 A* a# b  @7 c/ {
}& g/ [+ k7 Y; e  O4 q# v7 }6 k
lefttime=setInterval("scrollmarquee()",20)
$ F1 _' y: _& K$ j% u}
6 H4 H  N% \$ S1 K! |/ b0 W* vwindow.onload=populate9 ]+ L% A/ Y  F! T! P
3 Q9 ~! h4 D7 x2 I, ^: k9 o1 c
function scrollmarquee(){
/ d! E1 c8 O3 s- V  e0 vif (iedom){) y! w( Q: _4 Z( {& }# Y0 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' _6 ?2 r' f; C7 v4 O* S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) [" J2 B3 V; }/ z9 n# qelse
& P( l3 Q7 `, \cross_marquee.style.left=marqueewidth+8. W( g7 S/ X7 l

# ]# j( Z- q! Y( s) X4 o}
- x2 N5 P8 q% }; f! i/ d, Oelse if (document.layers){* Q) ?" _' c: m* z+ ]
if (ns_marquee.left>(actualwidth*(-1)+8))
* N: I# O/ b8 s& cns_marquee.left-=copyspeed; @" q/ _  U5 N( L4 V. X
else4 ^# r* f# v/ B/ {% V7 N, u, B* d
ns_marquee.left=marqueewidth+8
: V. Q3 d$ ?, k: ^6 ?0 y}
0 K5 ?% w" |; }: R. B, u9 F3 t}
. E" ~, v" Q6 h3 |4 H. \  J) ^9 z2 g/ {4 L$ y" V
if (iedom||document.layers){* Y" t8 c7 y, G' S& W
with (document){
$ O- e; E# ^  g- F1 M. h' o, k' Y1 pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): @: ?  p0 _9 F
if (iedom){0 _- k, Z- i; m4 Y7 P; a' Y+ {' L! e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, x' H0 C+ z& U6 H+ U: F) V& bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 [. j3 I3 G! t3 ?" U: ^8 w8 @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* q+ r) P2 o( Q% {3 A, J
write('</div>')
+ L. N% U5 E1 e1 a+ J+ e}
9 R2 }; j, a! \9 xelse if (document.layers){+ L! F6 @; }- u  m' w1 b" h: _. m3 _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. R3 Z* G: T5 i6 R* b! Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 W/ G) i( C. |( g0 Nwrite('</ilayer>')
9 }$ ?( D' z7 I! y# h}
& N: `! k8 d9 a5 \- X6 d/ |, G" fdocument.write('</td></table>')
/ ^+ r5 G4 _2 D}
; J' Z7 n, h- p6 A5 A' U: Z}+ A1 j7 ^: l2 h" b3 _0 g0 e4 B
</script>

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