返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 R2 ?1 u% z% t6 T. {4 ~) c
var marqueewidth=3000 P0 W" p1 a: x
//高度
  |5 E! M2 w; q; qvar marqueeheight=25
) T+ I/ L; F# }//速度(1-10)$ Z1 z5 O( O0 Q: O. L' J
var marqueespeed=3
/ P4 y% B6 f; J1 _; B) H. l4 s//背景颜色
" Y5 K% l3 B( ]8 [- pvar marqueebgcolor="#FFFFFF"( T0 N% q& V" ?
//是否能暂停 (0=no. 1=yes)?4 Y' C! b& }* n9 s% J
var pauseit=1
9 |) m; s' m$ K
! i8 L& Y# Y1 N+ ^& E3 S6 |//修改显示内容
/ z$ L! x) s0 _' F( Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; u7 i- q8 ?$ ?" ~( L

3 w$ I2 D: K' M7 s
7 c) A# [: r( @0 o////下面不需改变////////////. k& E( _5 \0 q! w6 `" u
# k1 [0 g2 ]4 n/ a" s
var copyspeed=marqueespeed  O- n4 q# Y3 ^2 @$ O. s
var pausespeed=(pauseit==0)? copyspeed: 0' z8 v0 G" J) `* R  p, M% _
var iedom=document.all||document.getElementById
) }4 ~, T! y! J# k/ B' m3 {& Fif (iedom)3 w! Z$ M6 e# ?2 h! x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ y3 V1 k# m$ q' g" m- O/ h! i$ M, ]
var actualwidth=''
% O  O  \8 X1 ]  N$ f9 s) svar cross_marquee, ns_marquee: E& y7 P& N' ^) y4 _2 R
$ d" Z/ b' `9 Y  U" h' X3 l
function populate(){; v2 ]. I. [5 l. Y7 j2 s' K6 B# a
if (iedom){% i7 I/ r3 Z7 Y5 {3 @) o/ S  e% n. W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( {5 f4 \2 Z. J' S. l9 E9 @
cross_marquee.style.left=marqueewidth+8
  J4 p9 W& B$ T$ lcross_marquee.innerHTML=marqueecontent
( x( \0 f/ `% l6 _6 \: P8 Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 u# G& {$ Q5 _7 p; m0 V1 n5 R( p
}
2 e/ y) d- g" \! I1 h. ~else if (document.layers){$ }# i$ g4 i0 M8 w( m1 y; r5 w7 y
ns_marquee=document.ns_marquee.document.ns_marquee2+ M2 g0 M- h3 k
ns_marquee.left=marqueewidth+81 c4 z) ^; e5 I" z4 B/ Y+ Q
ns_marquee.document.write(marqueecontent)* a! X; t) H% M4 l* _/ I
ns_marquee.document.close()
6 E9 i* y3 }: v  _2 I  F& Sactualwidth=ns_marquee.document.width
, \# ~. N' ^8 P; ^' M8 v}
% W1 r) R1 S* b7 L9 ~. R6 @* Elefttime=setInterval("scrollmarquee()",20)
8 H& V0 d1 O+ [}
8 @# R; P- A+ x( W4 swindow.onload=populate7 e/ i* L9 q. Y! q8 k$ P3 I' O

6 P+ S6 w' M6 ^4 Pfunction scrollmarquee(){
, z- u: w7 B# ~# q0 r$ q0 m, Vif (iedom){
2 F& F% N, w1 qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( ^8 k/ E. @3 M1 i" ^8 Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ @0 S6 w0 S1 ?4 B. J" b
else
! O( t% d! H3 ?/ R$ G& S2 T7 qcross_marquee.style.left=marqueewidth+8
: m4 p  T% O  o  M
8 `: g, M" O% M" d& h: L, c}5 O& K* D. D/ t. D
else if (document.layers){
6 g. h  X. J9 H7 @: Cif (ns_marquee.left>(actualwidth*(-1)+8))+ ?0 g  q5 M/ N0 T
ns_marquee.left-=copyspeed
: f9 B1 ~5 H; F. yelse
3 X/ k2 ^, O9 C* V& Sns_marquee.left=marqueewidth+8; G# D) p* \' F9 A; e
}/ E" K$ W* c5 m& R# f$ v
}3 J% {( G% E. T0 H0 c& g
3 _* o9 M; |4 }9 @. M3 Q' T4 U
if (iedom||document.layers){
8 Z' k" r" p9 O- ?. r& zwith (document){8 \$ e+ E  v7 l$ U/ {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" c" t. b$ D$ Q& ~! Wif (iedom){3 C% j: _" @- x  a$ |# F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 r9 t: y9 V. V) T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. f  W3 @' k1 A7 o( [) {# @( Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( k+ j0 W3 {# K; }8 R9 H8 p/ Jwrite('</div>'), d* P( Y8 Y/ O/ z" s+ ~0 t1 p
}, R/ f7 S; h# G7 {' d
else if (document.layers){: y4 t  ~1 j& i  W7 f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 ]7 d" {6 c, T+ B" F3 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& c2 o+ M  v/ ]* o) B. ^9 t- V) e) E6 pwrite('</ilayer>')( ^8 N& I/ I* J
}  R8 T$ I/ q' s' I# G. R
document.write('</td></table>')
3 G) m' e6 w: H1 O" f, r  {/ \  y}
+ n) u+ j) D9 d- y  [! G}7 B4 @8 ]6 K4 |, L- U; |/ s2 `5 D
</script>

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