返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 c% u0 v2 j$ ^9 B+ p; f
var marqueewidth=300$ ^1 q! ?3 t/ S- b- _, [- X
//高度. o7 v2 ?2 p" Z
var marqueeheight=256 T' c  \1 R* z; B0 i
//速度(1-10)
9 K# q- c8 k/ |var marqueespeed=3
9 w( J/ R' Q/ @. [) n( ~//背景颜色1 @* y8 P% m3 \& R$ K# Q9 J
var marqueebgcolor="#FFFFFF"
7 d. O2 @  W7 ?. i  T//是否能暂停 (0=no. 1=yes)?
' i" I, r  u/ Pvar pauseit=1
& o0 Z; J- r( j1 b! W, Q' V; M, s+ `) B
//修改显示内容& G7 c1 o- q: ?. X5 ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& s9 X& b# w" B

0 @3 A# b3 t2 S/ P4 P" a/ V) I, L: y$ y4 i& E- f8 [+ z
////下面不需改变////////////
8 i! h0 W% i2 o2 Z+ O! R
1 e2 w: U5 t8 `/ F. l$ R0 Rvar copyspeed=marqueespeed
6 n% O% f* F) v+ c0 jvar pausespeed=(pauseit==0)? copyspeed: 02 n9 Y8 {* a6 m2 R; A6 M0 J! g
var iedom=document.all||document.getElementById
0 [- P, [" J! gif (iedom)& C. s! ]+ T9 x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% ^% e1 I8 X& s/ `# r
var actualwidth=''
- q" I& W" F  Mvar cross_marquee, ns_marquee
. x  c! s; _  @9 ~! w% W2 j, b; R3 q% w( z# x- W5 S( _. Q/ c
function populate(){1 k! g1 A* h* n% r
if (iedom){& X) i2 U, b' z& c- c% B% E6 L2 C$ ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 ~6 Y% r4 M& T6 Z( H  N+ w
cross_marquee.style.left=marqueewidth+8
+ w$ [, A5 S, \, M( s0 ~( i+ wcross_marquee.innerHTML=marqueecontent
& x% u1 V& f5 sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& X- w9 C& a) a$ x8 E}
8 x0 e' x( V) p5 P! J* Selse if (document.layers){
# Y" z0 K! ]1 S6 y) X- \ns_marquee=document.ns_marquee.document.ns_marquee2/ m  p: t$ a; T
ns_marquee.left=marqueewidth+8
1 U0 _; d6 f9 a) L/ ~ns_marquee.document.write(marqueecontent). W7 z9 L. X5 v! C5 G" F
ns_marquee.document.close()
9 C0 G9 e6 k9 ?actualwidth=ns_marquee.document.width8 S% f+ f( j- i2 S3 X$ N! A
}
. i6 Y7 q* @1 G, ], L( xlefttime=setInterval("scrollmarquee()",20)& k8 C$ ^7 D. b% k. G) ]( S% W
}% r5 J3 ]% }3 \, r, S) X
window.onload=populate) b# x! _; g; I

) k  o4 v1 j5 G8 D$ G! V$ z2 Sfunction scrollmarquee(){/ X3 k; N" {. r+ x* ^$ |" g" r
if (iedom){
$ J! a/ @' K6 c7 S5 Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 F9 O+ M8 b7 n* x* D9 {! o, |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; G& g0 P- w7 I! p6 l; Q
else' {$ X+ j5 q; {5 a  o: V
cross_marquee.style.left=marqueewidth+8
/ G6 _' y  H) H/ ^) Y" ]
. ^/ P! ~: y3 C  T) {}7 ]4 k  i7 e3 L8 ?% t" ~
else if (document.layers){
. m) `/ x# [6 O# G7 t7 Jif (ns_marquee.left>(actualwidth*(-1)+8))
" d- |6 n4 Y6 R# t; ans_marquee.left-=copyspeed3 Q6 Z4 f6 {/ W0 ^9 K: J1 S
else
) f3 J, a6 A. s% D1 Q: N) Cns_marquee.left=marqueewidth+8
9 d/ P, B+ D6 i9 m, \, G}
5 w. ]3 a& ^3 ?' p' a4 U}1 a; H* a6 a( S+ D
' s1 I. T# P: V8 h) p
if (iedom||document.layers){
, n3 f: P% D1 s  C* q8 y) iwith (document){- x9 |  o. z7 M/ H! _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 F& _& K3 n+ |, m. [$ [5 X
if (iedom){
3 P; W! U: h% A9 d) p& `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 F- j: }7 Y. ^. ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 ~2 L" `( w( Y( Y( kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% H& p. Q, q: a: R0 wwrite('</div>')% _* Q. e$ p1 Y, n) Y! C. Z/ ^4 f
}" c- g4 K4 h1 L6 `2 {
else if (document.layers){' m) R  e4 C6 A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 q% Z$ w" b) \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) b2 W) c9 t6 c3 Gwrite('</ilayer>')
! y1 V- s1 }6 W}
& |8 L* ]: e  B$ e. i) Zdocument.write('</td></table>')9 ?1 Z7 Z- |$ K. n* d$ c
}
* v, h) W5 G# Y; h3 i- D9 [}' v+ \) \: B/ y9 c1 \& K4 i4 H& p
</script>

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