返回列表 发帖

网页之跑马灯文字特效

//修改宽度: f' l0 w$ H. J8 p; |; ~& H0 W
var marqueewidth=300+ z) N: p4 y! ]2 `$ v: }
//高度
1 W9 Z3 R! G8 b. ?- Avar marqueeheight=25' y; n. h( a" `4 I; J+ U6 }0 h
//速度(1-10)
0 w( H3 ^! V8 D4 w% V4 Z8 Gvar marqueespeed=3& Q, Y7 C; q" n, B3 [3 d7 J
//背景颜色+ r, H$ b& I+ k+ G
var marqueebgcolor="#FFFFFF"
3 a) R& T! A3 ?( Z//是否能暂停 (0=no. 1=yes)?4 t( a1 F" u* O! {% ]& @
var pauseit=1* D, Z( T  A4 j3 v/ B! f
  U; I1 _+ n3 e
//修改显示内容+ t/ U3 b4 O1 j' `$ d! L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 \' w+ k: ?, @9 G9 z

1 u1 u* n( S" U$ I, ?* u  S# Z7 S0 V8 N
////下面不需改变////////////
. w. \8 v0 }2 r: g; D* p3 u3 B3 o$ F7 H7 V" ~1 }" ]9 ]3 m4 d
var copyspeed=marqueespeed
5 t% a* M& T& i7 wvar pausespeed=(pauseit==0)? copyspeed: 0
- l. H- Y. |( M% bvar iedom=document.all||document.getElementById0 h0 F' U( C' ?& F
if (iedom)0 y+ a* w4 v" O8 e1 e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): M  z3 |5 a' X; |
var actualwidth=''
' m0 Z0 [0 E! a8 M0 n8 S# hvar cross_marquee, ns_marquee8 G2 E5 W  o9 Z" V4 K

1 g. i6 x/ F% B  w7 o9 j* r$ ofunction populate(){: c: }' U8 w. ]+ `3 a
if (iedom){! _/ \( v8 S9 S# R' ^) g2 [8 b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: U: }* f$ Y( C2 L  h9 @
cross_marquee.style.left=marqueewidth+86 V( t5 I7 Y" Z1 e0 B1 i- x2 O# I
cross_marquee.innerHTML=marqueecontent
7 l+ U( g0 \  B' y" K0 r* @, r5 factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 f4 P3 e9 A& H# e
}
% p; f1 p" o3 M5 Oelse if (document.layers){, [# N, z. n6 Y# C) ]$ m& U
ns_marquee=document.ns_marquee.document.ns_marquee2! l! j2 E4 p" W1 `) U' B7 k0 l" X
ns_marquee.left=marqueewidth+8& \* Z+ b4 @; ~; k
ns_marquee.document.write(marqueecontent)+ S" |% q7 P, s: M) v2 S
ns_marquee.document.close()9 G% q8 o0 n7 R4 ~) K) k6 R1 ]
actualwidth=ns_marquee.document.width; \# }3 l' u  v- |
}$ U8 H( e9 i% H0 M* z) e% T) e
lefttime=setInterval("scrollmarquee()",20)
) Z! i; T/ S& n1 f# u5 g}6 }5 q% [9 v6 g1 \# v% K4 I' f& v$ B
window.onload=populate
. ^* h. ^/ \6 ~
9 B7 g7 L: E2 t. e# P5 tfunction scrollmarquee(){
( [& h9 W  j; s8 G7 a5 {& {if (iedom){6 G8 \% w; K7 S% Y# t. r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 _! X7 r/ A2 H2 M. G' p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* p& Q4 e* R3 i% i
else
! X" c$ K7 b# A) t+ J% c9 wcross_marquee.style.left=marqueewidth+8
6 g! \5 K3 m& i  n+ T( r' S9 g, z6 M3 |
}. A4 p1 U  [- i* ~. a
else if (document.layers){
: ~& S" k0 f) P4 bif (ns_marquee.left>(actualwidth*(-1)+8))$ X2 h7 K. _3 }. f$ ?2 ^
ns_marquee.left-=copyspeed
/ |0 G$ B2 y0 q) D& X. zelse0 b8 _- H8 g" K. J4 O6 w" n5 X/ K9 e
ns_marquee.left=marqueewidth+8# u. b9 h! D2 U4 l: m8 Q
}3 L! P+ e  \0 @, w7 R
}
+ b3 `" g+ D) P8 V% p, N& ^% l" y1 }# n
if (iedom||document.layers){
# X! r& ^5 b; w5 twith (document){, w/ _2 N; y$ ?/ d5 P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, B; c+ t4 O5 [  D  b/ lif (iedom){
/ h6 N8 \" V" X7 Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, O1 `3 V- j' `$ T% p7 o$ K  Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ X' W2 h% M* f5 L% R- r; f) A7 a& {- o# e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 g# G2 t) m; ]; v# E& lwrite('</div>')* _* B6 b/ y5 n
}
' I/ D) u* {9 ~8 r# g) n% belse if (document.layers){8 J3 I. \& ?. w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( \6 J; L; o$ i  f/ |write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 Q% j6 }! m8 e# l+ zwrite('</ilayer>')" @. G% S& E! e4 V' x
}) _* Y) z' f5 `! A7 X  D, B4 x
document.write('</td></table>')
. d8 [$ P( s0 U1 f) |}
+ {0 D) B0 ^# o2 p7 d) g}8 y: `8 {9 K' [) Z
</script>

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