返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 t+ J2 O5 n' B6 @. O2 j& d; t
var marqueewidth=300( s* h% J: {! x# G: ]
//高度% x" F" \6 ^# `/ a5 `7 j) J
var marqueeheight=25
, q2 H. {0 r  c2 s+ }3 F//速度(1-10)
9 g9 J, O1 R9 C- Tvar marqueespeed=3
& _% w5 |$ l6 ]  x1 G9 V  ~- V9 A2 k) Y//背景颜色6 |, Q. ?" w' T# C
var marqueebgcolor="#FFFFFF"2 t; b6 ]& i/ o$ \, Y8 x
//是否能暂停 (0=no. 1=yes)?+ ~9 g+ z; a3 `5 y  d8 M1 T
var pauseit=1
) M) m6 |$ {+ {; g  r8 j' g
2 H! N9 z8 G8 r( p9 {//修改显示内容
, U# \. ^# Q% N. S! l% ^( O1 bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') M& V2 l2 h6 R4 F! I# V1 e
6 @1 i! u6 t- t" g" B: C5 S  J) z

! z3 M7 ]1 h0 c9 x; k: @////下面不需改变////////////) U0 y3 j0 P% o0 `2 o
9 |) a' z0 H2 |0 B  J3 s1 l5 l
var copyspeed=marqueespeed0 ^% ~! _1 ]/ ?
var pausespeed=(pauseit==0)? copyspeed: 01 N* u" \) f6 F6 i9 ~1 H9 R% T
var iedom=document.all||document.getElementById; i6 K0 K6 k( \( W1 v) X4 ~" g
if (iedom)$ @8 R$ W( j4 K/ h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  y; f( B3 W/ F5 E( p  j& lvar actualwidth=''
3 Z" g$ {: e0 g8 w: _# S- Kvar cross_marquee, ns_marquee
2 J9 y' N' K) i$ w' t5 s' ^! C5 a4 o: Q& X
function populate(){  k4 ^8 K2 p  R; E9 N' p
if (iedom){
# Z4 g% h* }$ Z# Z' ^. a; Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ a8 u; h) o' }1 d! G  w8 ]# I) F) X
cross_marquee.style.left=marqueewidth+8
+ a7 H4 x  z- scross_marquee.innerHTML=marqueecontent
# h: Z4 o1 I  u. B- wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 ]0 N2 x) V# J8 S6 T+ ~# M
}8 u$ q. l$ @; Q- G* ]! K& ^3 N! q
else if (document.layers){: b5 r1 K% t2 [
ns_marquee=document.ns_marquee.document.ns_marquee2
2 P- o# \4 L/ a* s9 G. y% d( o' ]ns_marquee.left=marqueewidth+8
% A6 c4 ]! L* R5 Cns_marquee.document.write(marqueecontent)
7 e- H5 x4 K* q; j# O- Sns_marquee.document.close()5 W% V9 a' e( ~# u
actualwidth=ns_marquee.document.width8 E: D/ K" A7 ~& `3 `# Y
}
: F$ l- ~8 q- Z. q; Plefttime=setInterval("scrollmarquee()",20)
9 A3 `- F( S2 u% }; [1 }}
2 P: {9 _& a% `2 H0 [6 _window.onload=populate2 h6 J+ I# {  @: A/ A- g3 a% \# x

. m* ^, }- d* H4 bfunction scrollmarquee(){7 \6 N1 Q6 O+ S8 e2 I
if (iedom){/ v0 H; |: b+ Y% Y$ M
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% v+ f6 ^) r( h# }0 R5 |) f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% q" G6 p# a( `+ B7 [& A* K1 J
else
# M* x2 S' v- j: Xcross_marquee.style.left=marqueewidth+8' D! b+ `6 g; o2 L5 B0 d

# q# A. v% W# Z}
* R) T0 l: Z/ q  ~. ]4 Kelse if (document.layers){1 A3 ?$ G: X6 |! `( D+ ?
if (ns_marquee.left>(actualwidth*(-1)+8)): S# h; l; ~5 V0 u: h% o, e3 x# v
ns_marquee.left-=copyspeed
2 M* l) w" T) S6 selse) u2 l& ~7 K. y3 z' E
ns_marquee.left=marqueewidth+88 p; H4 W$ M- `7 X
}
# o5 ~. I' |" ]}1 k& x: V8 I7 m8 M) L0 X2 w' P; Z
# L8 K4 ~, |1 i7 m/ U5 u
if (iedom||document.layers){1 Z! w  s6 a' v4 g& C: o) c( N& c
with (document){: P* U: ~# I8 _# m' ?' y7 ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ S, M* u* R( S8 s
if (iedom){% P# y1 n1 `9 {! h2 f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& W% h$ s1 X1 uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); v5 t# N( H5 h! z7 k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 M! `1 V4 h  c' z
write('</div>')
6 q9 J# ?* r, z% F. z}1 `+ }: G2 y- z( v' r
else if (document.layers){% I% b+ T. z( c/ V# X' d; K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 j( ?. v0 e" N% i' Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). W  v0 X: S" y( P, P5 ~) T: G$ \: }; G" q
write('</ilayer>')
3 a3 v6 G( D, {' e+ L}
0 i9 L& J4 T/ m0 `! \document.write('</td></table>')
# f! A9 {! B( K1 [# s3 q}' g/ D2 K  r, c) X" _
}
% R4 s) }, A! Z+ U) o</script>

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