返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 Z+ z  R' g6 S7 F3 j
var marqueewidth=3003 Z. W2 Q, p; q" G3 A5 r
//高度" Z( F9 j% T3 i. d" G
var marqueeheight=25
/ `1 R. Y! L( |2 M//速度(1-10)5 J. R: F+ `# [1 t  ~
var marqueespeed=3
7 c2 [, C" ]* W. {6 H7 }//背景颜色
+ T" L% Q0 V4 v1 U8 ~/ u* Qvar marqueebgcolor="#FFFFFF"
8 I2 q  \! g6 D' X! b- m//是否能暂停 (0=no. 1=yes)?
  s) y0 ~: k. W( Hvar pauseit=16 y# x. W. I/ a. N( Z5 B5 F
( [! e4 c( f7 _3 _7 d6 ^
//修改显示内容* E3 \5 h  j2 v' V( r
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# L6 J  j) D) D! z0 [
, J' {& q8 {1 s; t6 m1 F: h  Z, c  }

# m# L$ [8 t- x6 I4 }' ]5 p////下面不需改变////////////6 M$ F- r" E' s2 M0 R2 t
0 Y+ E9 X" a% S) N9 f
var copyspeed=marqueespeed' B/ c) [: S5 R% a) [3 n* u
var pausespeed=(pauseit==0)? copyspeed: 0
+ E$ |) F- R- ^; Lvar iedom=document.all||document.getElementById
3 z% q9 O. }) @# o% U5 [if (iedom)0 j+ d, U$ f. z  E* ^0 a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ _$ X+ E5 h6 I7 J; U9 Xvar actualwidth=''
3 @3 T; T9 h! l" l5 Y$ ]* E: a3 M% Avar cross_marquee, ns_marquee7 a$ ?9 N0 |$ u9 ?
! A/ @- k; P7 g$ ~: `
function populate(){, R4 B( m5 b: H3 e9 V; }9 E, }$ ^
if (iedom){. ~! X6 I) k7 O2 _& x6 L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 b! y" W- A, F- ^: jcross_marquee.style.left=marqueewidth+8( ~! O9 l3 Z1 {1 Z. S+ y
cross_marquee.innerHTML=marqueecontent" h* r! C; d0 a* d" A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( e) \2 p( i; G
}9 `1 K/ X5 ~( X9 O. C) T
else if (document.layers){
! h  d( x& a7 _ns_marquee=document.ns_marquee.document.ns_marquee2
, I* l6 h! ?) u" Nns_marquee.left=marqueewidth+82 t( n  R; |. J3 M
ns_marquee.document.write(marqueecontent)' u2 u7 b7 I; n& |5 u2 m
ns_marquee.document.close()! h) W/ [: w, u7 L2 I" N
actualwidth=ns_marquee.document.width
. F- g( F% A' h, e" m" }}
/ ]1 [4 X0 f4 Z$ p/ {! jlefttime=setInterval("scrollmarquee()",20)
' ~9 [8 P1 T$ j8 Y& [1 `2 p}" W5 H& S. _8 p
window.onload=populate
& D0 D8 `/ e; b0 A" M8 k2 S, S; {% B* T9 \: i  z- e
function scrollmarquee(){% X2 m4 g' ^# x) }  ?$ X
if (iedom){: z$ k4 ]  a8 |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! w! Q, n, c- e0 n7 S+ E; g8 \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: r. f4 W) I1 @# xelse
) l% {1 d; x) F$ ~) ~% V4 jcross_marquee.style.left=marqueewidth+8
) [* X0 m2 ~$ z& g8 q$ F, E$ ^7 }7 {$ V) b8 b
}+ S: Y0 u* w. r/ P0 Z# L: V0 C
else if (document.layers){3 W: \( H4 \$ V3 ]
if (ns_marquee.left>(actualwidth*(-1)+8))- _/ a4 N4 N6 a5 _/ v
ns_marquee.left-=copyspeed
7 J4 ]' x( l0 @& |. Selse
( N; |" A0 j0 g$ Dns_marquee.left=marqueewidth+8' w+ m8 q" t* J3 n* k5 d
}
  K0 W. z% o/ y3 V  d# g* j}
3 M" g% i& I% l5 a+ X. [0 P
! U# ]) u. }! yif (iedom||document.layers){! l& e, i- m; b+ r  f  l& w
with (document){
1 q9 m$ [, t% j2 p0 D8 Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  J5 O! o  r3 L2 j0 E: Bif (iedom){
! T8 Z! V( R8 A7 g( m3 A* Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( n2 d" b! ?% X, d9 h2 Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, s3 h! w6 k/ U+ H  h" Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' ?+ U8 S. Y/ e* C1 ]write('</div>')
0 f7 \- e7 U9 S}# d4 t, @  l0 a
else if (document.layers){% f0 [- `2 u& V0 W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ h# {% ~% t6 Q9 ^$ c1 @! J  X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), t6 ~! _7 d7 J& G7 Z
write('</ilayer>')# j+ [$ \& r+ z: X1 Y
}8 M7 v; A  U8 s% O2 t/ x; \3 a
document.write('</td></table>')
7 `7 O+ ~  L' n% P}
2 W4 {, X! r2 g) Q- y7 T# c. e4 C}0 O. b! B) }7 v* N" [) b
</script>

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