返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 R8 q& X& y9 n. h8 t: ]
var marqueewidth=300/ l: \) T- \' U) J0 s0 f
//高度+ ]6 R( z( w% ~9 y% H
var marqueeheight=25
% E. b3 a& }' ^. J//速度(1-10)
( Z* O5 j0 H' P5 t1 [; ^var marqueespeed=3+ t( x7 @4 l" D  i' @" g
//背景颜色* g8 M% ]. U% ?) ^4 u, I6 ]
var marqueebgcolor="#FFFFFF"+ }8 C/ u: R' O3 G" ?
//是否能暂停 (0=no. 1=yes)?( ]& R. Y4 V; P* j+ W2 B; {9 p' C- s
var pauseit=1
) W% L6 G* w! p* y& l( q" H+ ?6 m' @% k2 o0 m! z3 i  ?% c
//修改显示内容8 Q% o: t: K2 q! v# y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 T, ?. _( J; U1 S( i8 [% u
- a9 K* K/ j( q, |3 e' b

( X! b. ]- s) B6 P. j! b0 c////下面不需改变////////////3 I' l7 `9 G, x
' i% |$ j! P! e8 _" z
var copyspeed=marqueespeed
( b  Z. ~  J$ \: b/ l* Vvar pausespeed=(pauseit==0)? copyspeed: 08 o, ~, ?3 q. I& s1 m
var iedom=document.all||document.getElementById% \6 Z$ J* o( [9 y3 s/ Z  e7 {* ]2 {- ]
if (iedom)
- ]+ h$ j9 U* k2 S  \. Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  R( @# y- n- \2 n  mvar actualwidth=''8 k! m( C5 `$ S. f! H4 n
var cross_marquee, ns_marquee3 R. Z2 V- ]6 \

- V2 y- R0 l. xfunction populate(){
, f/ k' i$ S* }+ v, Dif (iedom){9 m3 i: r* m& y- h8 O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ Y- U; }8 M5 g; Q
cross_marquee.style.left=marqueewidth+8
! O% ~! N3 X9 C+ ~9 C( Gcross_marquee.innerHTML=marqueecontent4 \9 k8 _' R5 T) \6 b& W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ l% e9 ^( E2 o$ e
}. R/ }& O. _3 a5 V7 i; m2 K
else if (document.layers){4 [4 X* C% A+ c) C
ns_marquee=document.ns_marquee.document.ns_marquee2
7 u; L$ _$ R5 U0 m2 g& a' nns_marquee.left=marqueewidth+8- h$ V" e2 W& T- e
ns_marquee.document.write(marqueecontent)1 f  y' e* n( [
ns_marquee.document.close()
9 a/ y+ w- o/ l5 B/ Wactualwidth=ns_marquee.document.width) Z. T# H: T% G% m) g4 O# X
}
7 D+ R" _5 w- q% G) I8 llefttime=setInterval("scrollmarquee()",20)$ ^( d7 Q1 r. p/ l$ z
}" Y% t* f6 s" t+ F* h1 O
window.onload=populate7 Y/ A8 O! D  Z: D

0 h! |0 U9 |$ c& q' O7 L9 Cfunction scrollmarquee(){
7 }) t- G( e1 Dif (iedom){
6 z. \1 Q1 k3 j' h$ ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- a4 I- J0 l% [% x. j2 A
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) A) T: j) G7 m) L" Selse
# j0 j' J# w: B( L. w  D0 T  n- V+ Gcross_marquee.style.left=marqueewidth+8
; Y: K6 ]4 c% s& G3 u( ]  Y: s/ Q% t6 k( ^+ f% F% {5 `9 g0 O
}, n6 u- V4 ~0 d7 Q6 K  O" H
else if (document.layers){, W- i' }9 p! W& z3 o- R+ b
if (ns_marquee.left>(actualwidth*(-1)+8))
; {, r  t7 A( v) G/ h7 S& tns_marquee.left-=copyspeed
9 }" w6 Q9 _6 Felse3 l2 c$ A5 T- E1 `& h
ns_marquee.left=marqueewidth+81 a9 `: E# k) k
}
, L7 m5 D5 Q; w6 H. W. S( p6 y+ }}
0 b  K' d6 Y2 J8 w) {: P! j7 r: l& _" t( w; z5 W( D" N1 f) F4 ]
if (iedom||document.layers){! ?  h: p' e1 p7 u, Q
with (document){
2 H% ^; B9 V; k& ^2 x  @/ O5 ]/ Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 [& [& [* a  o; jif (iedom){/ g) t5 m3 b" y" \5 n; W0 I5 g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  g) t7 s( i6 @3 `  O+ \' d; Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. H$ h& s" ^2 t! l5 Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) U0 _6 N/ o3 S" |8 ^( m' `  _& J
write('</div>')
% H4 D; o1 m! _}
- E" G$ q- o) O: Zelse if (document.layers){
  ]: d. X7 @6 j, a- E6 \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 S6 M0 f" x' a, H6 y. i4 }6 n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" G  S" `* Z. q- i! {% W' S6 a
write('</ilayer>')3 a' p. h- v- w5 J3 A- P* w, W
}
- A4 X' Q( v* R. z0 ]' b7 ldocument.write('</td></table>')/ E. }/ D! ?1 Q! W) A* W5 z2 `
}' _2 ^$ C4 Q+ ]0 p% B
}( X1 o; S# ~0 N$ M
</script>

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