返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 T9 K! u4 y6 |# Z* _) Y+ ^var marqueewidth=300
" b, y: Z1 B7 y+ d# b# g6 q8 X//高度7 A, P+ Z9 l$ x7 L4 x
var marqueeheight=25
5 D& W3 o8 W! D6 B: ~  a# @/ J. w//速度(1-10)
& X+ s! B  k9 z; H; Xvar marqueespeed=34 c" ~) ~, _4 |1 q4 }: b
//背景颜色2 W5 g: B) N6 L" O( Q  E
var marqueebgcolor="#FFFFFF"
+ O+ E; U. K; s4 N+ m  Q! f//是否能暂停 (0=no. 1=yes)?
0 P* i, L7 d7 bvar pauseit=10 L  `) s# K& T8 M6 H8 k+ A9 B

& N. z( l0 [+ C* y6 l//修改显示内容
2 s6 R) A% [- P& b1 }6 [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& @* r" u1 y1 x- d$ [# h9 n$ U7 `+ D$ \7 e- U" g( l) w
( G) d. f# g' R# P8 t/ N
////下面不需改变////////////
$ ~- J- d) K3 P: `: r+ d$ i' x! N' h( D# w5 ]8 N& ]9 ^
var copyspeed=marqueespeed
/ Y7 x$ U% C* y# W  _var pausespeed=(pauseit==0)? copyspeed: 0
9 v6 _0 Y; t; u) U0 bvar iedom=document.all||document.getElementById
! |- i' L* {! D2 u- H* d6 l2 Q; d2 Jif (iedom)
1 Z/ J& ]3 u* V, j9 edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ N4 |4 X' q* C! l. o
var actualwidth=''
( t# f% l: A0 Dvar cross_marquee, ns_marquee0 H9 D' }8 N! ~$ \
, E0 F; U( ^8 R* I" K! X
function populate(){( j) w% ~) ^& b
if (iedom){, L0 t( \: B0 i- ]" W5 }
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 Z8 G+ g: h% b
cross_marquee.style.left=marqueewidth+84 D  g) Q. \7 R) {
cross_marquee.innerHTML=marqueecontent
( @4 Y2 U7 i- W, ?5 c, Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 S# u" e" K& S) d  R}
' f# ^8 [7 \# S  @3 qelse if (document.layers){+ b6 v6 t+ K7 |. _! x
ns_marquee=document.ns_marquee.document.ns_marquee2
( S$ L. W4 m! b( m7 y: y1 X7 {2 d& Ans_marquee.left=marqueewidth+8
# V' N8 P, h. [: e1 K; v2 W0 Mns_marquee.document.write(marqueecontent)
, k, H0 d3 k! e0 fns_marquee.document.close()
2 Z% Q& j+ h0 M4 E: D& A5 K% {3 s) `  Iactualwidth=ns_marquee.document.width
# ^0 z' a7 ^. l6 i2 g; D}4 c- Z3 ?- c# L5 R7 m5 D/ Y
lefttime=setInterval("scrollmarquee()",20)
2 @' y0 z0 H& J1 O+ u- P7 G}7 r0 w" ?$ H: j& l2 y% P# j
window.onload=populate
  T6 e6 l& B) q" z' Z( H
) s3 J; O& @0 n0 R8 Wfunction scrollmarquee(){! M% @8 c8 S6 ?+ j1 w
if (iedom){
$ T' W" Y. O) l$ kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 ~/ [, M( Q# \( q% ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 U  b9 Z0 H! z( y/ X  S  o. [else
% Q0 D1 H. s$ T9 Y" T# [cross_marquee.style.left=marqueewidth+8* r: ^+ ^7 t$ P+ j$ ^* f
2 y1 \5 x$ {0 t
}
* U5 ?. T) u; R" velse if (document.layers){" T( S9 y* @+ T( L. f+ z
if (ns_marquee.left>(actualwidth*(-1)+8))7 x2 ?! m/ R  D" S1 [
ns_marquee.left-=copyspeed
/ z: }/ I& x/ Y7 m# P. l! Yelse1 ?' v6 k0 ~1 l% z3 j
ns_marquee.left=marqueewidth+8: V  O+ g$ ]9 e, d
}
9 S5 H  q: L5 ^( q3 T# I}5 A4 I0 L9 Y& W& ?7 M
4 H+ r0 @  x4 L7 _9 A$ M5 S3 R1 e
if (iedom||document.layers){
; g& @3 }9 f3 a: W' B4 ~2 Y1 owith (document){# u+ {# ^) p  f. y) S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* [# S# Y; l3 _: i" b- uif (iedom){
. f7 l, y) M& C2 G; B  `. ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. L" t8 r% P6 x' H6 ]% y* Pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& o( `& F2 D; D1 T- o" `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) j/ K+ M$ P8 k! K' H( c. M0 X3 \write('</div>')9 w) [5 V3 o& T2 Q- b8 e
}0 I+ k7 W/ j8 j  U+ f
else if (document.layers){
: R# q; X1 N5 S" \$ a. t+ ^2 X; ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# U0 z4 }, y4 b6 Y1 L4 ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ f7 \2 A% z0 Y. D2 l1 _( a
write('</ilayer>')% o) q- x  F4 Y; d  L+ g
}8 ?5 P+ a$ P8 n/ L, ^3 V/ E
document.write('</td></table>')3 G% s, m9 u0 j3 n( v+ N0 Z
}8 G# q& k1 L8 }+ G; H& ^# ^4 T* m$ Y
}
! e7 c, l& d9 W% g</script>

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