返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( R" s) ?8 h- c. L( b: @2 s0 evar marqueewidth=300
$ v" P( f/ @8 v4 z+ K! C9 l6 a9 z5 B//高度' F* Z! F' a" t4 n2 M7 M2 O
var marqueeheight=25
1 ~* s+ T1 |" V2 y7 x0 T% g//速度(1-10)
4 b- B7 e5 N, O9 M6 Evar marqueespeed=3+ c7 C' A3 r% u5 I+ _
//背景颜色
6 K# i) C  s( N3 h6 j# h# cvar marqueebgcolor="#FFFFFF"
# m" E/ J5 ^9 _2 i//是否能暂停 (0=no. 1=yes)?4 W# l, T5 X" m3 K" O5 y; ]
var pauseit=1
& c( N! j* }5 f5 _& F* v. ]
, @7 S4 g: F, J0 H: ]- ?//修改显示内容- Z# E* ~' D+ P! r# \" {, e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 X% l8 A8 C" D1 _
5 C9 R/ o' j/ u" Y6 u& F
( U. r" I- |, m: \: \  M% ~* q: M////下面不需改变////////////. u* a7 Q; W2 }$ n8 t

$ }4 G$ h4 X8 ^8 ]) w, y" Z% Z1 g+ Vvar copyspeed=marqueespeed
$ l6 l( k/ }6 N, H, N- o" Hvar pausespeed=(pauseit==0)? copyspeed: 0/ r7 b7 ?2 `0 k8 G, F2 t
var iedom=document.all||document.getElementById$ }! l7 n4 E; v) E9 M
if (iedom); H. [- E7 ^9 |* x6 P3 Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ g/ D* n9 n: I
var actualwidth=''
. ~/ p+ Y& }/ kvar cross_marquee, ns_marquee
" q; R# `/ v/ {6 M9 @4 }: {
) h+ U" A, {. Z1 Ifunction populate(){
" \+ N3 X# F5 H1 G' t9 Tif (iedom){* y2 X2 r* A' G0 j% J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 x* s& c' j/ P: o& t6 `cross_marquee.style.left=marqueewidth+8
. @! X/ c5 A- X0 f' J3 Z! `( pcross_marquee.innerHTML=marqueecontent4 ~0 K3 O! @, Q) N( M( d" }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 _# @% Z" @* F4 L3 b( J7 T}4 G! p" h  K0 L# y
else if (document.layers){/ i) a% o, ~% U, v/ N" z
ns_marquee=document.ns_marquee.document.ns_marquee2
0 P; J; R5 k. p0 N; l2 |  }0 r. Ins_marquee.left=marqueewidth+8$ w/ S/ h5 X+ i$ s: L
ns_marquee.document.write(marqueecontent)  Y0 [. Z9 P4 z6 I3 U
ns_marquee.document.close()4 y0 o9 }4 d# r: C2 [
actualwidth=ns_marquee.document.width
% p5 o  ~  Y5 [: ]}
% G7 m3 S8 g. N+ Blefttime=setInterval("scrollmarquee()",20)
7 d1 C2 ^4 _. X1 y}
: j7 ?' Q5 N8 K5 v2 M* X& `window.onload=populate
, K0 T( K, U* G; T, ^6 m
! T6 j; K. N/ D2 h9 ~7 `# e, Yfunction scrollmarquee(){
9 M7 P4 V* e* {$ E6 g+ B5 Hif (iedom){
0 k% K; D# D6 q" T4 W% B8 cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 g/ W7 d/ k- P8 F; D& xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 c7 ]& W5 I6 K: u  d, `& ?else
3 g4 Z% J2 n5 f, o$ o5 V8 ncross_marquee.style.left=marqueewidth+8& |4 g& x: J/ r$ H/ Y8 }! a: z

" Y) j, u& n6 g% K# A1 l" u+ z: q}
* ?1 F  s: V3 n; Y9 U6 s2 pelse if (document.layers){+ W& v1 @) G% `% X  }6 W* [
if (ns_marquee.left>(actualwidth*(-1)+8))
6 ?% r% o6 n  W% s# H" [$ Jns_marquee.left-=copyspeed3 o: l' T7 ]* n2 O0 `  p9 M* _
else" I/ ~% |  N& X$ r5 E1 v. d' d
ns_marquee.left=marqueewidth+8
7 j& P6 @% p) a4 ?5 N}
( L0 P6 k& J: ^9 W1 z, E}# b2 Q2 i+ h! U% O
) y% x0 T" h4 H
if (iedom||document.layers){1 T3 r+ [# ^; {1 k
with (document){9 H3 Z' ~! x1 Z7 Z* B, z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( N0 Q; C- g" ^8 c4 N
if (iedom){3 H, i. d" r, S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) Z- E  x* U/ Q) G& ^. t0 T: H1 O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) y) y' \  ~6 r9 V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% z$ s/ G* I+ B7 p4 rwrite('</div>')
. b  }3 [& e6 g/ n}
& Y5 q+ X# b  a4 R( Z( N) melse if (document.layers){' x- P- r8 L( H9 u7 T) |; d4 ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ k5 N1 |! @9 j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 D- B& @" }# V* {write('</ilayer>')
- j4 o* Z5 F4 T- b( {}0 p3 F  \! O8 s1 s& N$ P+ A
document.write('</td></table>')7 j( ~/ i+ Q( }- n  E
}
3 \; p4 J. w+ F7 S" g2 W}  i$ t( b% h: j5 I. E
</script>

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