返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 M2 D( j* |0 c" |3 d6 E  ~* P# jvar marqueewidth=300
) N) z! B0 z5 @* e# c/ v4 ^! j//高度- I5 k3 C- ?2 G$ y1 F; G
var marqueeheight=25
: @/ G% F0 d% a1 ^7 y! N! ~//速度(1-10)
$ c- N. e& J1 e( R* [9 xvar marqueespeed=3
- D/ ~" r" l( U//背景颜色$ v+ _9 ^1 a( D5 {7 i7 N+ H
var marqueebgcolor="#FFFFFF"# Y% q, p. T% [( }, c' g  J/ M
//是否能暂停 (0=no. 1=yes)?
. @; P' S) @& q6 O0 hvar pauseit=1
; n3 n9 A% E3 m, J' {; n
: H: i0 F7 E0 c' \6 u8 h2 \9 X//修改显示内容( |: ~& O7 a5 X7 N2 D" ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 q; Z* l$ T8 {) A: H
( |0 z, l. T. h5 G1 l. R1 `
: ]2 x+ ^' W9 ^' |6 O) ~  ?////下面不需改变////////////: y; S1 P0 D3 R* o7 Z; Z1 u3 Y

  h# v  b, W- k) e# G; Pvar copyspeed=marqueespeed9 D7 ?+ i4 \7 _+ m% M
var pausespeed=(pauseit==0)? copyspeed: 03 X1 ]5 L2 @2 p& H! s% d
var iedom=document.all||document.getElementById
  o0 {9 P7 \/ z( I1 Qif (iedom)
' d. H3 h/ n( L& D; @; Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ p+ y* |6 Q! n) N) j8 s: R
var actualwidth=''
7 i: ?) S- ?# q, A1 M0 z+ D) gvar cross_marquee, ns_marquee8 [7 D% j" ]6 ]: l( O$ O2 }
# t- f0 i. g; E7 ~
function populate(){/ C1 e# E# m+ f
if (iedom){; `9 X8 w: v& s  L" n9 ^8 h0 O2 |/ I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( M) j+ A! L- b  @4 Jcross_marquee.style.left=marqueewidth+8
$ D/ X- M, @' E% J# T6 tcross_marquee.innerHTML=marqueecontent& J- n5 V8 ^) N5 G: K/ n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- z$ I) Q) N) @5 r# Q" y}
$ P$ F! l( c4 g3 x: selse if (document.layers){
5 M. V8 Y$ P+ |* Q9 H7 P( @0 ?ns_marquee=document.ns_marquee.document.ns_marquee27 W. m0 l. u. W+ ]
ns_marquee.left=marqueewidth+83 |3 V6 E% L0 \- ^& P$ {  j
ns_marquee.document.write(marqueecontent)
  v! A  x" F4 j! Xns_marquee.document.close()
9 B9 D; o5 S* R( g0 P) }3 P% uactualwidth=ns_marquee.document.width
; n9 E, N2 p/ G9 ^, ?2 T7 }}8 n$ D* l6 ]7 j4 f. l2 P
lefttime=setInterval("scrollmarquee()",20)
  ?, b3 L7 J2 Q) L( Q1 p}" M" F2 s! v8 K& ?3 `
window.onload=populate
% ^# i/ i+ @2 G3 e; }% ~( @0 a5 P( i
. `4 m' h" Y* qfunction scrollmarquee(){; S& U6 U$ F$ ^2 D% g
if (iedom){
8 s+ V  x! z7 T8 j1 ?; `; W8 X, kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 b7 {4 m7 F* r/ icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# x6 O1 T( B% G% U: f
else* _# d# o) K+ N( K  G1 y6 x
cross_marquee.style.left=marqueewidth+8
  Z2 t, e9 Q  N3 @( h3 A
5 B. o% @0 A8 j9 E! p# Q}: C7 w, P+ o1 A: d3 g9 G4 J
else if (document.layers){
% {+ n% Q  o2 ]; J; yif (ns_marquee.left>(actualwidth*(-1)+8))
7 I( i$ I  L3 K4 K+ \, Pns_marquee.left-=copyspeed
$ {3 g9 q% n# ^. q5 `$ velse! {  @# \* q& @% N5 G& i
ns_marquee.left=marqueewidth+8
/ A5 e; i+ m1 K}
7 \) K! M  ]' F% {9 e}
* t0 F5 P+ n* w2 {0 m9 d8 A. P1 U! m. j; ?* }; M8 q
if (iedom||document.layers){
8 X9 Z" o# z  [8 Twith (document){* w$ x; A1 V0 ?2 k0 }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# D! @4 ~# Y5 f/ ]! U9 I+ M3 m
if (iedom){- Z5 h9 d# i6 F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): `4 t2 B7 i9 x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 G3 Q; s- j! l) \; m5 M
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( Y- g, f1 E. `7 m+ Z8 u
write('</div>')* e$ M- R- e+ v2 j
}
. ]1 P+ ^- ~! R, Z, ?else if (document.layers){2 j3 j/ B5 v. Z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 v$ q( [% ]' L# `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; y% u% \1 a2 p1 k6 r( `write('</ilayer>')
. @1 F6 t  R5 c2 Y) k5 o}8 ?+ p/ W& M% n% m* i* d% ~* a* q% Q
document.write('</td></table>')" Y3 V! B. f  [* m
}6 X9 q  L' `9 c5 [% Q2 K' H
}; F' ~+ Q& A2 D! a& v5 b' J- I
</script>

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