返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( Z* @+ i5 [: B$ P) s. Yvar marqueewidth=300- l( g: C# T) b8 I; q
//高度
5 B& |) ]* i1 m: }  Mvar marqueeheight=255 a) d/ L1 b  \/ V; }
//速度(1-10)7 X  s* R( v  Z" v; X
var marqueespeed=3' N+ W& C4 ~- m2 J- B( d
//背景颜色
5 b2 o& \, ]" M2 l7 gvar marqueebgcolor="#FFFFFF"
) i5 H- S* f& X: [4 m//是否能暂停 (0=no. 1=yes)?9 g1 b5 [) |8 X+ W) e% a$ y
var pauseit=1
6 w- Q9 R) Z' X* ?
4 T# Z7 o! ]# E( r. ^//修改显示内容! h3 ]$ k: u' S/ E' ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 s7 v5 u- p' K% {, b; f( K* b* z
, l9 v3 q0 a, \9 F! B, y
) B) G5 H, `" |2 W* C////下面不需改变////////////
. J' B9 r6 w, s8 I* l  K
3 q2 }5 k: F* }, v" R/ |$ u/ Kvar copyspeed=marqueespeed
" s8 m) r+ o: Z- D/ o1 Ivar pausespeed=(pauseit==0)? copyspeed: 0
/ w* k0 T8 Z/ B9 o5 Zvar iedom=document.all||document.getElementById" e& m5 }% O4 \/ X7 F
if (iedom)
: E1 ?. ~3 e7 J4 ]. [! |: m/ B* Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 ?  _+ G# A- W5 B4 d3 V4 ]
var actualwidth=''
/ \; b8 x! x4 f" nvar cross_marquee, ns_marquee6 O' ]) V/ u6 k7 T  p

- z9 I4 E; g( P$ U  A+ `$ U' ~- Ifunction populate(){
8 u# X8 x: B% H4 b% }8 l7 o6 C1 Mif (iedom){
& U) Z+ @' e0 s. S, y6 Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 Z' I" q- ?( r1 G( K8 D
cross_marquee.style.left=marqueewidth+8
; {* |+ u- E  d4 X/ G" R# |cross_marquee.innerHTML=marqueecontent$ O. `4 {7 W; V5 K1 M1 e# l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 h7 ]! G  x2 N) k/ @  u}
! y5 q$ Z/ E! K, V! i# x9 H! telse if (document.layers){
- n# }0 e5 V2 {4 R3 Yns_marquee=document.ns_marquee.document.ns_marquee2
4 P0 y& v9 X/ F9 {) \ns_marquee.left=marqueewidth+8! f- H% Q! ?. t. A, m
ns_marquee.document.write(marqueecontent)
) A' G5 S4 n' V$ kns_marquee.document.close()7 |1 N# c/ N  N
actualwidth=ns_marquee.document.width" K8 G5 D9 Z$ u/ x
}
& F5 @. @8 ]8 k1 s$ Hlefttime=setInterval("scrollmarquee()",20)
4 `; p( t& J, T* \}$ ]4 e" V$ b1 g. n+ O! c1 F
window.onload=populate# @5 X! m, X& G% `0 D* W$ _1 _4 I
2 l3 D( [  [* s) c9 ]2 \8 e
function scrollmarquee(){6 N" u0 l" ?2 [6 r/ q  r# y/ B' J
if (iedom){1 g4 S* f7 W4 F/ O# h1 P4 j* ^! a
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# i1 N, X8 E5 t* R) e( d) ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 K6 H/ [1 |: P. J0 p% u6 x3 `6 v
else
8 P& V3 P8 C+ H+ p; M8 ncross_marquee.style.left=marqueewidth+8
5 B$ S3 v  s3 L# Q' Z6 }+ n; K; V' [/ r: o: k
}( p) Q  a! k5 @5 ]0 Z+ k
else if (document.layers){( x& {6 j$ l. I+ T* O6 u
if (ns_marquee.left>(actualwidth*(-1)+8))
; E% h4 H1 b, u" q+ qns_marquee.left-=copyspeed
% d( n9 g: \' v+ \9 I; Pelse
  [4 F1 r6 O0 cns_marquee.left=marqueewidth+8
+ }0 K/ s- M: L1 V: s}
) c( Z$ Y9 E0 q1 r: H: ?}
, e/ ]8 I% d3 @0 T) p- r- A3 a0 G5 t% h% U! V  C
if (iedom||document.layers){* k! E- C% T) Q
with (document){; O# M+ p; e8 K* m( V' O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 d* k5 ?! d2 r% }. E& _1 S
if (iedom){7 B" }. d8 T& d( S( {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  g5 k' \6 d5 F7 @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' v# h% M. R/ X( d( M+ W% Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 f+ k8 ~) T& R" y$ rwrite('</div>'): ~4 d8 O# {; {) N; w) q
}
5 q$ |6 r! b! _' ~7 U/ Kelse if (document.layers){% C: a4 o- P' y$ J5 X! e; R7 U
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 w9 n2 h+ V6 f7 b* B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): j5 ^$ s- @% {. L* C( B3 V/ {
write('</ilayer>')8 _' T7 Q& d( U9 I- V
}
$ V( c3 w. r1 R3 k5 kdocument.write('</td></table>')6 ^4 E* f6 v0 f/ I( g
}1 y% _6 Y7 A/ \$ a. k  F: H
}. q5 T4 O0 X4 O6 K( A  n% m
</script>

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