返回列表 发帖

网页之跑马灯文字特效

//修改宽度
' s) J$ u  }( s" I( Hvar marqueewidth=300
. B- j* I( Y1 E. z//高度" g: s# k$ H& I$ i- D
var marqueeheight=25
( k3 a2 E/ L$ l) ~; Y9 H9 j8 ]//速度(1-10)  y; z$ V  D0 y. O
var marqueespeed=35 O  ^) k3 \- F' i+ K* ]& {; J! q
//背景颜色
& g5 P/ Z/ k( N' g: y# Avar marqueebgcolor="#FFFFFF"' d- @# y" Q$ \( o. s
//是否能暂停 (0=no. 1=yes)?
" m) S  \6 D$ c1 r0 `; f: W7 f: Bvar pauseit=1' Z( ^5 N( P  H' C! O* x( s2 p# K

' z/ B1 _7 A0 z$ L3 {* A* X" r: Y% s//修改显示内容
: H3 h( S1 d/ i9 L8 J& Q' |# C" wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. I9 \0 J" |$ v3 `& ?

# T' N! z* F# g  ?5 d2 z: g7 ]+ Q% ~
4 s$ j) V3 ]: w+ P) m- c/ E. \  C1 j////下面不需改变////////////
$ G* i7 \: C2 S9 N
8 V* k  z" l: d$ }( n: L1 p- |; Vvar copyspeed=marqueespeed5 W2 ~+ }: F% H; q5 k
var pausespeed=(pauseit==0)? copyspeed: 0
, T% j' x: y% |5 h0 Z! @var iedom=document.all||document.getElementById+ F/ `8 N$ P8 X3 Y8 \  o. {8 N% D
if (iedom)5 n7 I# @( o! E- }' V) u1 n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), p* m/ N' U9 y# \/ w7 M
var actualwidth=''3 |. I& R7 v3 i/ r5 o
var cross_marquee, ns_marquee
* u9 x1 m8 G$ M6 i# R+ _6 y1 M' {) p. ?- ]6 X  |
function populate(){- m# L4 \- s4 n  f( A2 p
if (iedom){
. @$ \" ]9 f) Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 `3 r' N; E, N% P2 Fcross_marquee.style.left=marqueewidth+8
9 @+ C* u& B/ Ncross_marquee.innerHTML=marqueecontent: T& U3 a. H; k, p+ `2 I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, O$ H/ a# D0 O/ ?( r0 ?$ X1 e
}
( X" z) W; n% S6 u$ K- velse if (document.layers){1 W5 n8 b* G8 I" i
ns_marquee=document.ns_marquee.document.ns_marquee2
8 o: S6 s2 I) bns_marquee.left=marqueewidth+8
. D* x3 U, v% X/ b; n- Tns_marquee.document.write(marqueecontent)
$ h% K1 v. [; w! J# T- i! Sns_marquee.document.close(), O! `9 t) u, ?* i; T9 p: \) L
actualwidth=ns_marquee.document.width
. \. V' c" H. d5 o( V}
/ h2 M" [; y8 f( ?6 K0 _lefttime=setInterval("scrollmarquee()",20)! I) B) l. S6 v
}
5 C5 x( e2 H( d  w0 hwindow.onload=populate
$ c* c+ M: q( Q* Q8 R5 H" {6 j
: c" i3 r. a/ N- J6 J$ Efunction scrollmarquee(){; M4 O7 U2 s/ o: H
if (iedom){2 C- C% k7 {! U7 a
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) T$ y0 I% {% b3 W2 q0 Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% s' Y! r  N' ]9 k3 L/ {' i$ d
else
* C8 \! n4 k6 z5 Q& xcross_marquee.style.left=marqueewidth+8
) B' G7 K& Q  J# t' ^8 A7 W+ \: M% b' ~1 S8 N
}
* q$ X) l+ s  x: K! {9 j8 X. X7 y8 @3 ]else if (document.layers){7 [& O3 G* s9 f. N$ d4 x
if (ns_marquee.left>(actualwidth*(-1)+8))- ?6 w* E# w% I9 ~; i6 b+ ^! y
ns_marquee.left-=copyspeed+ e& p2 [$ C5 O6 v( j& N
else: p; ]- e6 _$ R. i3 Z1 Z& ?/ m
ns_marquee.left=marqueewidth+8
& Z5 G  _3 U. v* W5 h1 m}
/ t  C& {0 H$ \$ g4 \1 N! \}
* p. b* U. U7 R4 r. M- C# u
6 m7 y4 g  z0 e- tif (iedom||document.layers){
! l: T7 s: f6 Y. Bwith (document){( L. j8 @4 f% k0 x8 a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 J4 M: n; E. i- p
if (iedom){# H' l5 U6 h6 E% t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! l0 h9 y' G2 b1 V. r. N' dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* W' M: e# B5 C) j/ o3 G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 {# y5 b3 ^/ K+ b8 w# U: l. Jwrite('</div>')' f0 t2 o/ R& c- s! C$ q* P
}
* _6 Z1 u- L: I0 yelse if (document.layers){! B& T# j( @: N. G- T4 d- d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, v. {* Z" w% f8 |7 Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  W; U) R- ]( O# n
write('</ilayer>')
) ^5 N( _6 D4 {4 h6 Z! B}) J4 `, t; Z5 F2 r" |6 P% M5 E
document.write('</td></table>')
  y; c* i8 s8 i  }. R}
% _$ H! q: X. O/ t" }, b  d}& \7 x, E/ l' ~9 e; ?! B1 S
</script>

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