返回列表 发帖

网页之跑马灯文字特效

//修改宽度& ?. @2 b: x  M0 K' k& W5 l' {
var marqueewidth=300! i% n9 s4 Y2 j2 x& l
//高度
% X6 x9 c/ K, t2 C- Tvar marqueeheight=25
, |) n1 m' K( N. {. o) Y9 O; J4 s//速度(1-10)
/ u3 F  U% K' s3 cvar marqueespeed=3
% l5 l: U& |" r& W- w& f# U1 S//背景颜色
9 ~0 [" O0 h) S" w. N$ rvar marqueebgcolor="#FFFFFF", j  L/ z9 ]4 b) V* n
//是否能暂停 (0=no. 1=yes)?
9 }9 ^* B3 Y$ m) Dvar pauseit=1! r7 @. ]' u8 i3 w& ^  W) Z4 S: F
9 X% f# ~2 |4 ]: m
//修改显示内容" h- o5 }5 _* T% t  {) U* P) p  Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' {1 J5 \/ B! C: X
- I: A1 s7 _  Q* c3 |8 y6 ^, O+ M, t& i
////下面不需改变////////////
& ^. F9 Y' }) x$ M+ E
5 e) Q. L- g# l9 A: w6 Z) _var copyspeed=marqueespeed
4 c$ Z' E( Y1 c3 Cvar pausespeed=(pauseit==0)? copyspeed: 0
5 `: e* s# P! wvar iedom=document.all||document.getElementById
' |$ c( z3 K9 U+ Yif (iedom)
, n' a3 {0 r( T5 idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 Z) W. |% C. W6 d& p
var actualwidth=''* P2 \8 i0 B# V; v
var cross_marquee, ns_marquee
- r- h7 ^: H  D  G- c0 Y: d$ p
) `* ~# V& ~6 r, S7 Jfunction populate(){7 ^  M' O. [7 S) f' ~' Q4 X
if (iedom){* K2 p) n4 X  o7 S. r" n0 M5 y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 M% G9 Q3 c+ Jcross_marquee.style.left=marqueewidth+80 S. \$ l8 K( G
cross_marquee.innerHTML=marqueecontent
1 Z3 |' u" h, {4 a6 U9 Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 b, G% v  E& H, Q) p" H' q
}& Y: N2 J$ Y& a
else if (document.layers){6 ^+ l# {/ G9 o  i
ns_marquee=document.ns_marquee.document.ns_marquee2
  x- @' O* x$ Fns_marquee.left=marqueewidth+87 D) W) g# \- x8 ~
ns_marquee.document.write(marqueecontent)
& L9 D  v: o* G) ^7 p0 yns_marquee.document.close()
& {4 t5 k/ V3 u& g% }actualwidth=ns_marquee.document.width- v6 i; P. @& ~; U  ^4 a$ W
}+ |7 p: \6 [0 N( k" J
lefttime=setInterval("scrollmarquee()",20)( ?6 i5 R; L! s1 c6 G: y
}
& `# I9 z+ H$ swindow.onload=populate
% V4 a0 g6 \$ |$ j; r$ E, i  m# o# j' E  k* F9 g, q2 X3 r
function scrollmarquee(){0 Y# f8 ^1 O* _9 x% P+ B
if (iedom){
+ `0 X) \4 W/ Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 K% r& x2 B( G- `% U; [+ ~" Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" M1 x0 W* G( ]; A: j0 W# M
else
' |" q+ o3 ~" B9 }+ Zcross_marquee.style.left=marqueewidth+8( V* q6 U$ B6 j% ?* Z

, c, D- n8 l5 B% A& n6 e}
% |1 Q5 V4 }& z& l! I: w1 ~) f( ~else if (document.layers){) S" A; Q3 K. P) I' H! e8 a; v
if (ns_marquee.left>(actualwidth*(-1)+8))
' ~) }. X5 b& s% F& U% z% hns_marquee.left-=copyspeed) u2 I  O3 T- o$ }
else
/ M5 X" b) f4 X" }) o! l, A0 gns_marquee.left=marqueewidth+8
& e6 c" v, u( v3 Y& O}: ]" e2 v3 X  e
}0 i' [+ `+ [) t3 [* I  F6 ^7 q

" }( H% w) l  T5 h9 D! O" Kif (iedom||document.layers){$ t, f& A5 ~: m5 B; L# E
with (document){" V# o  B" X( R- N1 B5 p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 S, x5 I$ s# j8 x3 ^3 m' i
if (iedom){
& R' `8 W+ }) C/ Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% _0 V& x% y$ @, y5 h! i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 K) M4 @0 X) X2 x* L7 Z* c) L/ ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( P) Q9 H* v. n9 F: }' N/ O! C
write('</div>')0 c9 X. r# f4 j0 o$ I
}+ K% e% W- Z) |' M6 y$ J
else if (document.layers){# D5 R, x8 Z( ?; X& `9 K8 s6 l1 @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 w" m* G0 n) @4 F6 t9 N( }- n1 |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 H8 H: x/ \& A( m& r1 v8 `- |write('</ilayer>')
* D% f$ H8 e. ]' k" p}
$ s+ W2 l5 O! Z4 Cdocument.write('</td></table>')* P/ c. x2 Y1 q6 L* K; ^9 g/ p
}& F5 V$ Q2 v# r; ?5 I5 k
}* ]  N/ x! X3 w
</script>

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