返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 S/ [' x; @6 O
var marqueewidth=300
! N3 Y" U; c7 z5 Y2 V: |% k//高度! Y: J, T& H) O6 k
var marqueeheight=25
% r% `5 `3 J! K: h- v9 m" Z//速度(1-10)
. ^1 `) O$ G& b6 ?" f* \0 x2 evar marqueespeed=3
7 y8 |" h9 ~: d9 I5 Q//背景颜色: A% ~! z' M$ ?% Z1 l1 @8 A
var marqueebgcolor="#FFFFFF"
8 S  L! y  f* A( u2 ~//是否能暂停 (0=no. 1=yes)?
, \  Y- o# t' q; ^var pauseit=1
- b; v) E7 A6 V
% n! }8 ]. U% b, I4 t//修改显示内容
% u3 k; F4 A$ i! V$ g( }0 o1 z% M* ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') d* ]/ i% h1 @3 g6 w8 \/ a% @( H' x

8 ~5 u9 @# C' a  M! [8 x' |
% v( R; k) u9 \& }////下面不需改变////////////
" G' W) j9 l# w+ l$ ]/ n+ T; Q
7 a  a& O4 B+ b4 jvar copyspeed=marqueespeed( U" N" N( T0 \. O: S+ C
var pausespeed=(pauseit==0)? copyspeed: 08 B6 |: p+ t( y3 A
var iedom=document.all||document.getElementById
- y8 U0 K1 h+ i! V0 E. Dif (iedom)
. k/ z" n! w) cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 i4 v9 I1 ~$ K* h) G4 V
var actualwidth='': \8 \$ K. ]6 \& W- ~' b3 X, @
var cross_marquee, ns_marquee- ]- V# h" k, |& a# Y+ `( R" q

+ I) s5 U" A. K, c0 v; K! m; vfunction populate(){% j7 F) c; w: e# t
if (iedom){
. V) f4 J9 b5 B) Q' V7 @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 B' f5 @  ?5 I* H( M3 [cross_marquee.style.left=marqueewidth+8
# {$ B% y# w0 M+ ^4 B1 Lcross_marquee.innerHTML=marqueecontent
& V4 @' V3 ^$ e7 n7 ]5 xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 @6 |1 ]( M6 z* J! u1 h" e- {}
; j5 a- N8 J& X" H0 telse if (document.layers){
& {) R" q# ~' U* I7 s7 v* Lns_marquee=document.ns_marquee.document.ns_marquee2
' X% U* P1 p# }ns_marquee.left=marqueewidth+8
- ~8 X9 t% i* T  lns_marquee.document.write(marqueecontent)
7 T& U4 b; Z9 \) Nns_marquee.document.close()
& Q0 w: o# C* q+ l2 Gactualwidth=ns_marquee.document.width' l5 s5 E) p% f* a5 f! L
}3 C  d" |( `; l
lefttime=setInterval("scrollmarquee()",20)
; C3 L$ F' k. m1 q}3 v) [  `* w5 [7 O
window.onload=populate
( s2 ~: C/ J# s. X% X3 T+ g
; s) a" H1 x. F/ D+ Tfunction scrollmarquee(){6 c# g1 N' u& Q9 ?, @1 H/ E3 c+ j+ `2 q
if (iedom){% d$ ?' b& J, q# p4 ~1 q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) m: [: q5 Z( ~6 e. u4 ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ i5 w$ z3 y$ J) R$ jelse
( A7 g! P7 V0 J9 ^9 Z! \. y, b3 lcross_marquee.style.left=marqueewidth+8
0 Q4 C+ L* z1 O# W, z/ R6 @7 A1 Z  k5 b4 I$ C3 {3 `  ~
}
- v' z$ W" B6 j- J9 Z7 yelse if (document.layers){
+ U4 v8 h& Q2 {% s8 Sif (ns_marquee.left>(actualwidth*(-1)+8))* J+ S, o# N2 I( a6 G
ns_marquee.left-=copyspeed" V" K3 ~. n, P  p$ C$ `
else
) m8 s3 V; p% u& h( Sns_marquee.left=marqueewidth+8
2 k# }$ n1 ]7 _: R( K. a) y}
& ]# s  E3 M+ ~$ i, q}: W6 S$ G0 C5 X; H9 W' U7 d
5 h9 j* K! |4 v
if (iedom||document.layers){
" b, j7 I  U* n, i$ z, t% H& {6 Lwith (document){! T7 l7 S, o( o' Q! M, {# P3 K& S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ F& w& F0 a! H/ V  H( Dif (iedom){; z7 ?# u* I# T/ N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 ~+ P; S2 _: w  ]6 Rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* J$ w0 ?+ v# ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 c* ]5 Q. {# z5 Y5 y% Y) S
write('</div>')# i7 `4 t6 ~# a1 A) N, Z  A' m0 c
}: m3 k4 b8 V0 v3 H! |. t* [
else if (document.layers){6 [# t# s* K1 [% C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 O3 J0 L& e& G6 o- T4 j# kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 J& i2 q  q, L9 \- Bwrite('</ilayer>')! s* C: M+ l* [" V( g
}
/ V6 Q3 p! f* k+ M" U; \1 zdocument.write('</td></table>'). G6 ^. O/ I: U2 ~
}
' r$ V5 R7 D- t$ {2 h# Z}
3 }, L5 U; D8 K- q8 Y3 O, o1 T8 r</script>

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