返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* c* z% o" Z% p( D5 t, B4 |var marqueewidth=300
$ c2 x7 P6 w/ W& |# _& T//高度
# k) ]6 J  i% mvar marqueeheight=25
5 k- P* S) [: t! f2 `) [//速度(1-10)
) ~7 k) D  f4 Q+ E7 @var marqueespeed=3
3 {6 n2 g' e9 h* |( q! d//背景颜色
; a6 _% L; y( f- ?" Pvar marqueebgcolor="#FFFFFF"3 h5 B9 W$ n. ]& Z
//是否能暂停 (0=no. 1=yes)?& @( _; A9 m! X! z
var pauseit=1
6 f) d2 a: `5 R6 C9 \& ?9 A
5 m! A3 y. Z+ b3 l# o//修改显示内容
7 b! e6 U9 ~  L! mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 H! j1 w( I/ k! }

. z# m2 [0 R! P/ i# A
) |- W* k7 x% w$ m8 k) b////下面不需改变////////////2 i, \  v8 ^. k0 E0 c' s) I
4 A: @: ]1 Q7 A8 Q- T2 j
var copyspeed=marqueespeed% i  |  L* T' p! h- f
var pausespeed=(pauseit==0)? copyspeed: 06 d3 `+ _; j4 \; ^
var iedom=document.all||document.getElementById4 g6 J9 I$ u% I
if (iedom)2 Z5 R$ W' S7 V0 L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 j0 x3 g8 u2 s2 b. a" O: y& o2 gvar actualwidth=''+ P; Q  h& |; j4 Y2 ?
var cross_marquee, ns_marquee
' X& s# G' ?. h+ y4 a% n+ N8 Z: q; X: P) j# [% \+ f* {
function populate(){
/ b9 b) l5 [# V/ U' Pif (iedom){% ]2 w' l8 c. x  D" R& D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 ~3 @* J* R) k$ o! v
cross_marquee.style.left=marqueewidth+8
# E9 |; M9 _+ l' C: {- Wcross_marquee.innerHTML=marqueecontent+ E' T' c( f' o9 {& F$ W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 a5 h8 [5 a1 b7 @}
0 T8 Y/ O7 @- l! [* Y* B8 Pelse if (document.layers){1 S2 j, F2 }7 y) \" L9 X- P
ns_marquee=document.ns_marquee.document.ns_marquee2( e( [  S" G& b
ns_marquee.left=marqueewidth+80 c: F: C% t' M( \3 M+ B
ns_marquee.document.write(marqueecontent)
* Z8 g, A/ G6 c' Nns_marquee.document.close(): ]- t# n' w' i( v0 ]
actualwidth=ns_marquee.document.width
, C; w" f8 ?& B}. A. Y+ V: o; y
lefttime=setInterval("scrollmarquee()",20)
; }" ^- T! F# s4 o3 M}
' [: N1 Z4 c' t! U& t- L& Nwindow.onload=populate  a# I- Q; [  \( i
) O  ]( E8 P4 S" q9 {2 _; ^
function scrollmarquee(){
8 m, S6 A+ N& x! jif (iedom){
' u( C3 x! d5 u2 [& gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 x9 V, B8 {3 W+ S2 R) ^: M
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) X$ o" s3 o4 x0 l- G( zelse
% Z* q5 i$ `; ?( ]cross_marquee.style.left=marqueewidth+84 T; e: j- y4 f" A

* c2 ^) T) k) e' ^7 L}& I0 K( z6 d! m8 R& G
else if (document.layers){
  \* j) Y; w1 ^8 t6 b" Tif (ns_marquee.left>(actualwidth*(-1)+8))
  Q  \5 u" c! h! e1 ~3 @ns_marquee.left-=copyspeed
6 \1 X* p3 E; F- \3 x# X! F. \& Belse7 e6 ^7 ?5 Q0 [% C* Q9 T, x
ns_marquee.left=marqueewidth+8% E. I& {2 O* H2 y) W
}' Z! q7 N3 x! k, ~4 Q
}
. I  G+ |& q  d: @5 j5 [' L% Y( O: Y* k3 Z$ A% u/ b+ w
if (iedom||document.layers){$ }9 C" _$ B( l" p* u
with (document){
5 n$ \" ?& d- z$ U/ o) mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 g9 h8 R: ^  @0 y
if (iedom){
$ O1 l! }6 D+ J: x3 ~) [6 t) Q( Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), u) n3 m, Z5 ~5 g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! ?  ~6 w9 G' ?% Awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% p8 I1 [" T# b  a) \- J# Z1 Y
write('</div>'), J* j& q& d; M( ], s
}: _# w" f, A8 z1 Q( h: }# s
else if (document.layers){
% u# Q; F& u8 j. Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 t4 Z+ L- B# b- e- [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 k! H6 g) N8 C  L$ a' awrite('</ilayer>')( N' M# F. ]* ]* n
}  R! C$ [! }8 i# a( j4 g
document.write('</td></table>')
  @! j- Q/ }; }2 }4 p" V9 b( L}
; P3 [( f# _7 @}4 G+ S3 r* |: B. _; l
</script>

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