返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 F; k( j- `/ J' z% F  N$ U& i. j
var marqueewidth=300: O' `6 u, {! M
//高度: _9 H+ r6 y9 `* ]6 U3 W
var marqueeheight=25% h  B  t. H% {9 S- e5 n
//速度(1-10)
! |' l' O+ m) r  o3 |# evar marqueespeed=34 L! h% Q/ n! S
//背景颜色' d! }) ]/ H# F& F$ h
var marqueebgcolor="#FFFFFF"6 Z* O+ O* K% C/ E. x& x
//是否能暂停 (0=no. 1=yes)?
' j9 X0 ?! L# D% o, Uvar pauseit=1
- \9 Z$ l; w% N( e8 O; q( w! A& _" x+ Y2 H$ n
//修改显示内容  H+ B) }4 i" E2 O. ]6 t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* F/ I+ F; f& w
, b* `* l% c! U4 Y+ @( I; ?
/ ]$ s/ @/ C6 `4 D////下面不需改变////////////: J: a/ n+ x8 |7 o( m

$ G5 z( X0 [8 D2 J3 Z/ {var copyspeed=marqueespeed. D1 ^- u4 m; @. B; r
var pausespeed=(pauseit==0)? copyspeed: 0( e9 ]4 S2 |# ?, y: m8 d! @
var iedom=document.all||document.getElementById! J, _3 N( M1 ^  R" w1 i6 t0 o
if (iedom)
& \* b% T  _+ W0 I* Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- V! M6 {* A! ovar actualwidth=''# D" x! o; j6 X$ J8 \- |
var cross_marquee, ns_marquee
+ z. U$ ]  P) O0 O7 K2 [8 a- K0 R, a' u. S- Z. V9 @
function populate(){4 x1 C$ }7 y2 ~- ?! i9 c3 H
if (iedom){
' l' T- d3 M* D' i9 B$ I( \cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# _0 q3 p9 m/ f7 e' J6 Rcross_marquee.style.left=marqueewidth+8
% x0 v- y& \" ^1 Gcross_marquee.innerHTML=marqueecontent
$ y. w8 q1 ~5 _& Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 E4 J8 `# \! |}
& W- k1 j2 @4 z1 b& Helse if (document.layers){, m) P0 T$ m. `: C+ }0 j$ X
ns_marquee=document.ns_marquee.document.ns_marquee2* }) ~% i4 R  L  _8 U  u5 l8 {
ns_marquee.left=marqueewidth+82 U6 Y& N( \* F# y0 I. F+ c+ ]
ns_marquee.document.write(marqueecontent)
, t' e( H3 s* Q0 E8 E& ons_marquee.document.close()0 N' j: a( {8 a- Y- y0 m
actualwidth=ns_marquee.document.width$ x3 V( K, n6 f% o7 I' r: }  x
}8 Y4 G. k0 N6 M! r( i* \  _
lefttime=setInterval("scrollmarquee()",20)
) I! a  r$ F+ S( m* V/ X/ b# V}
: e3 }% O7 f  y" r1 uwindow.onload=populate# s% _- S5 ?/ M) Z1 j9 F: N/ ^

) F5 _  f6 p0 }, r: ~4 A, nfunction scrollmarquee(){% j. h  c/ G1 R
if (iedom){% ]2 z7 m2 d- h. i0 o8 j% \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 N9 |% ~" e' z- K2 Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 u: D5 W2 }" Z, Y, k. uelse
( H0 T8 J' K' T1 e0 H! U* X! Qcross_marquee.style.left=marqueewidth+8
% N% s( G, N( O3 u) ]- Z$ d3 s3 S% |) ?% ]( m
}
6 a5 `) L! \! j5 G) _2 m) V) p3 Pelse if (document.layers){
$ |4 l. V7 m/ Y- J% Fif (ns_marquee.left>(actualwidth*(-1)+8))
% l% T& M2 x5 R' m; f4 Xns_marquee.left-=copyspeed! o& o( }9 C6 z$ M( u2 }  E
else1 S+ i9 k% V+ k2 ~
ns_marquee.left=marqueewidth+86 u+ x6 W  S7 J5 I
}: U" R* A; C* f) q+ t0 n2 H1 r
}
; Q& {+ i) h/ l+ n2 d1 Y. ^3 w$ i! x0 y$ y7 j. c
if (iedom||document.layers){6 a5 `8 E% h. X1 l8 X) {5 w
with (document){
: ^% G% l$ M4 F) s# B* y1 adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ E* _" U7 w- ?, n$ e0 ]if (iedom){& l, G0 f8 {& i4 ]3 F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% U# W. s8 @) z! C2 h' ?( [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" D9 h3 D9 q& a+ }4 ]7 x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! s: ^* H* X* m' Z( w* {3 E
write('</div>')
6 r# h5 X' p. E  D}
6 a% {9 w% x5 L* gelse if (document.layers){! |! e9 d. }2 q! j4 n. k7 H( Z$ K! K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& ~# F$ x7 y( [' Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 f; r$ a- _2 `$ B. W; p$ d0 Nwrite('</ilayer>')
9 D& l; x& ]' j% s* \! V) x3 c}
2 X% R' Q# q8 x3 D3 |document.write('</td></table>')- g" k0 L& u. ?6 @
}7 ~6 J; I5 w( K
}& ]7 G) g( J1 a" ~) [! p  [, V
</script>

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