返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 j  B+ {, e; F8 g+ b" W4 ]var marqueewidth=300+ b8 V  K8 T3 J" h. ^6 X) R
//高度* i4 ]6 I+ h9 J# x$ A
var marqueeheight=25
7 r, O3 s' o, X2 s8 A/ J//速度(1-10)
$ N" R; R1 V$ R! h! A, q' _' P$ fvar marqueespeed=38 i3 y+ `: J. I5 C/ {6 d
//背景颜色0 H9 [' ?' C7 b$ n0 J6 M8 @
var marqueebgcolor="#FFFFFF"' e5 n% {) B6 ]1 Y
//是否能暂停 (0=no. 1=yes)?
+ P7 P5 Q  F' f! j9 @" avar pauseit=1& n+ x! i* C$ p+ b: E: `2 K
2 l4 _& N- S2 I) L5 b
//修改显示内容
  y: G; ]& @8 i6 |5 t: V& @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') V& _$ m1 y' H
6 G! n. Y  L0 L2 k4 m

! H4 r9 O$ ^/ i) _4 Q2 J, j& p////下面不需改变////////////: G5 G1 u8 V2 @' ^  G  j
+ _7 q1 d( n7 N% @. g2 _
var copyspeed=marqueespeed
! b7 P7 F0 D" b+ b6 c3 c1 wvar pausespeed=(pauseit==0)? copyspeed: 0
! ^  P0 _( G7 z+ e) A( u9 h. yvar iedom=document.all||document.getElementById
0 E8 y! L% ]8 F2 ]" Mif (iedom)
, H* x, k# z* b& Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) o, W) t' _; _/ a
var actualwidth=''9 p! T: l& o' C0 Y
var cross_marquee, ns_marquee8 q1 I3 Q7 z9 l7 ]( e6 l+ W

7 |# ~3 b3 ^, e" a, l( Zfunction populate(){0 v* V- t* {6 s' G$ S/ [
if (iedom){& B) h" o! c- n$ n; v. e% g+ w% c
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- S6 v2 s2 w8 j( y5 ~cross_marquee.style.left=marqueewidth+8: S" |( w  C$ ^9 |) }& \
cross_marquee.innerHTML=marqueecontent  o# w) b$ z5 R, w6 t. K/ z# ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; R; U& \* A8 ~/ y8 m7 b) P4 Q9 u
}) _. O4 a. f" Q( T  k3 G
else if (document.layers){: x8 o2 Q9 ~( a' l
ns_marquee=document.ns_marquee.document.ns_marquee26 r9 H6 x8 Q( c
ns_marquee.left=marqueewidth+8
3 L6 S! {# J% Z$ R' k6 F# t6 Ans_marquee.document.write(marqueecontent)9 r/ o0 B" \4 M1 \$ M
ns_marquee.document.close()7 \$ ?- v1 @2 `# q+ h& k- P
actualwidth=ns_marquee.document.width
0 B  E; L/ w2 e4 w! J}  N# p5 \: z# d: J5 x4 ?% w$ L
lefttime=setInterval("scrollmarquee()",20)6 L# {6 I* q1 k- i
}
5 j' H4 L: f2 b$ _window.onload=populate
# k+ p9 a. f. j$ L; W$ k* z' A! r, [# ^8 p  q$ C
function scrollmarquee(){) g( k9 Z- M/ S9 k
if (iedom){! T" {$ B( A& ]/ A& L: q( C/ J2 Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 P& E3 {4 b* u& K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 F, v7 Y% ^/ L: w$ U
else) x: ~( I: J8 [' w0 z% |- W/ C( q
cross_marquee.style.left=marqueewidth+81 p  }7 E5 u" u3 q9 g2 _
" O* @  M/ i2 w( _
}3 w( f/ d- ?9 y6 j1 w5 F
else if (document.layers){. N; J9 G, j+ X0 Y
if (ns_marquee.left>(actualwidth*(-1)+8))5 D  C7 [% K8 O& Y$ J8 y/ i
ns_marquee.left-=copyspeed  A6 {" \  @  w* _$ G1 h, j
else
+ x9 k+ E, t' b7 H2 k/ lns_marquee.left=marqueewidth+8
$ M/ ?  E# r" T. r}
5 ^$ n, s7 ?5 J4 n! R, u. I0 ~}3 U" I, A! p4 P. w$ v* A: G
' W. p. ~% t: k8 v& s
if (iedom||document.layers){
# O* n  v- X: z! t( [# X9 M7 Uwith (document){
( a% V! A) t; E( Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 c! u2 j) j. A9 p" |6 x+ I
if (iedom){, a* j5 L: h1 q/ X$ c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 c9 \9 |2 |' V7 t' l& Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 o, x, L& _* O( N6 u' r, o2 ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- h/ d4 D; N: t1 @; X
write('</div>'): M! m4 v1 H& j- j
}
7 J9 R% f# C: H5 V5 `else if (document.layers){
. x9 k. j4 k' k2 t4 Y! r/ z# dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" Q: b8 q0 v! O) j+ f5 x% Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 |. |5 F2 s/ M/ w$ y" c+ ^! Z
write('</ilayer>'), Z% n" ?" d; P* [/ m# s3 q
}
6 C& s# K- A9 L. w' z5 Y( |. F, Bdocument.write('</td></table>')
. K+ _, `1 x) |, e1 T. p- x2 w% P}  }, l: v! {4 y
}
0 ?0 }  m& j% B5 K6 f4 R* y; a9 y6 S</script>

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