返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 M- C, i# w) D# _; `& p
var marqueewidth=300
1 N( ~( R% D% X5 B  l. `, J' K. X* o//高度2 F& b& J/ z% @8 y% Y6 q& v
var marqueeheight=25
6 F1 N; u$ k; H/ q  t' y- J3 h7 Z//速度(1-10)# G9 ], _. I$ y3 j: ]$ j- D: u. t
var marqueespeed=3
+ Q- y0 b# t7 x/ W4 v$ [//背景颜色6 P. Z: L; w' n5 z  Y! {" {
var marqueebgcolor="#FFFFFF"8 e  {$ p' \- b) `0 d9 T
//是否能暂停 (0=no. 1=yes)?; E; }7 V5 \# G/ y4 }! n6 G, q' G. z
var pauseit=1
3 o. p' d* q/ c; a0 T& P, ?- W
! {% Y7 d9 }. t6 i! h//修改显示内容
; w0 h& c7 I1 j! T0 ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  h- L: c: y( R; |' f8 Z2 a* E

3 u, i3 ?; L0 P$ n% a# O: g% q3 s3 u
////下面不需改变////////////6 z7 e# M" e" ^* N3 Q' M* r$ W
" |: p- N6 H* I5 h3 L
var copyspeed=marqueespeed; `9 [: O: t7 T+ ]# u/ \
var pausespeed=(pauseit==0)? copyspeed: 00 A/ Z/ J: G0 B
var iedom=document.all||document.getElementById
8 M% w6 T) F+ P- y4 t# b2 hif (iedom)+ p9 r. ?3 D3 }9 D, d/ B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 N) ~2 ]) O+ }0 ~2 b5 v
var actualwidth=''
. P0 u# v+ c0 i. }3 |5 V- s5 S' {2 ^var cross_marquee, ns_marquee
- I) {8 S6 q: `% }
- ^& v8 K7 V' j- V9 Bfunction populate(){" h3 V3 W1 L0 l7 r& ]- ?
if (iedom){
- R: E' i( d! P' U' m- Across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; {9 E9 N2 k) E$ h6 D1 [
cross_marquee.style.left=marqueewidth+8& T. O" q' }& }( h" p! m; B
cross_marquee.innerHTML=marqueecontent
: l; v. i0 R) M7 G' O* ], nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 L# I: t5 H- G. B}; z. P# A# A0 y3 c
else if (document.layers){4 X% @. c% g% k4 m9 R9 d% S' c) u; i
ns_marquee=document.ns_marquee.document.ns_marquee23 n; A; Y0 p1 z% {
ns_marquee.left=marqueewidth+8
0 d( U0 h# k$ s8 Cns_marquee.document.write(marqueecontent)' P/ {" R4 S( M# K* f- l
ns_marquee.document.close()
5 C+ p7 v/ n: `5 Factualwidth=ns_marquee.document.width4 Y7 b' r! y0 o, x3 ?  t
}
9 v/ |; C+ P3 J5 a3 M# H, I6 Zlefttime=setInterval("scrollmarquee()",20)
5 U# i) h4 W" F: e9 H}+ n" q( b/ ~& L2 n
window.onload=populate7 c9 d& O+ D' t0 R0 a

9 O2 B+ w5 ]4 u( t( wfunction scrollmarquee(){
6 T& q3 c% }1 S1 {7 z3 M3 qif (iedom){  Z4 S; {( T5 L9 D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 E# k' {( ]' ?  N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  I! z# f/ p$ [5 K! v5 s9 K% h* ielse. r! [) a2 v- D1 i: a9 S& n
cross_marquee.style.left=marqueewidth+8
0 S, O8 G/ U: I* y+ [7 {- f8 Q4 U' F0 w
}& \& I% g; S. _: X! [+ R/ I
else if (document.layers){) k; o2 g4 C6 Q5 j
if (ns_marquee.left>(actualwidth*(-1)+8))
( \# p) v4 a( ons_marquee.left-=copyspeed$ ^, E( b& R4 Z6 k  j+ z
else
+ L4 ~* w- r: ^. t: gns_marquee.left=marqueewidth+8
$ x) K1 B/ f- P( A( n! M- \}2 K! ]% p* {8 l1 [. D% W
}8 _% p) A. ]( h; ?/ K$ G$ R

' U4 ~% s3 U/ B8 uif (iedom||document.layers){0 M" j: |$ k& v0 k- i9 u& o
with (document){
' o7 I7 D+ o- b& Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), n" s  y) g5 E
if (iedom){  v  _1 Y5 F" H" h$ ]8 r. h0 d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( m. J7 i; P, fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 u' b; C3 c, ~- U. t' h0 nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& y2 m7 {2 T  S9 F  e
write('</div>')- _. Y2 K' h; t& ]" w% E. f# Z
}
, {- Z4 a" t* P3 A, selse if (document.layers){
6 I7 u) X1 \; q+ a$ }! P) h4 y6 Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 e- I+ G3 k/ ?, j4 Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), T( y0 D/ s" M8 ~7 v
write('</ilayer>')
. G8 Q* @1 Q4 K0 C2 Z  K9 x4 D' ]}
1 k) |9 L0 w; H; ldocument.write('</td></table>')# w4 H7 q& h8 s( Q
}. z6 n- V  u3 Y
}
9 b, q. ]$ q/ A</script>

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