返回列表 发帖

网页之跑马灯文字特效

//修改宽度* J# n. K( f) D3 M6 \) k* k2 T, }9 A9 Q
var marqueewidth=300
4 h" x3 ]$ D/ l//高度: l& m6 F0 t* h6 O1 ]) x
var marqueeheight=25
& o1 p5 {. P9 j1 P, E& _//速度(1-10)
& _0 [! Y2 Y, Dvar marqueespeed=3
  g& [( ~: r2 ?5 f7 Q! F& W1 L//背景颜色
# d) Z# g- x* y  e3 d  j: e  ?3 \( Rvar marqueebgcolor="#FFFFFF"
1 {3 k6 W& [4 y" E6 v//是否能暂停 (0=no. 1=yes)?
2 E% M. z3 y0 C7 Avar pauseit=1
' x$ L( M- G3 ]# I
7 U5 I7 x: g$ I4 F% R* e//修改显示内容
7 N# x- R/ M: W4 e3 Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', j/ j4 ^& Y: m, v1 b8 n

3 Y( I& D/ f4 [+ P3 _! e+ J8 z5 K$ |7 B
////下面不需改变////////////5 a8 s. d5 T6 b7 d# S5 Y0 R! X
: ^& t. H8 B. p3 _
var copyspeed=marqueespeed1 U& N) J0 Y' e& g+ T; V
var pausespeed=(pauseit==0)? copyspeed: 0  _( y. B0 }% F, M; t
var iedom=document.all||document.getElementById
# S0 j0 E7 U, M- j( I  G, yif (iedom)6 s: y$ O  k+ f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 W0 g/ F1 f) b) a8 v7 Z% g0 v" Jvar actualwidth=''
7 L% Y' P1 ~( j* J1 i, E- b$ dvar cross_marquee, ns_marquee! W+ {9 h! ~# T; L8 T

" i* b4 S8 x( L3 A  x( |function populate(){/ n( g( m; c. d: K$ O0 z
if (iedom){
* K) w. a( L  y9 o' a3 C% Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 ~" v, S* w- J* p5 l) Z
cross_marquee.style.left=marqueewidth+8; z5 _# A$ L6 u
cross_marquee.innerHTML=marqueecontent  L" ^4 a7 ]1 b, `; a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, _0 T  M. v- ^& L/ p
}0 m/ v. O+ s" W% o$ ?
else if (document.layers){* x, r+ k% Z9 e
ns_marquee=document.ns_marquee.document.ns_marquee2% }4 ?% a: ?% t( P! m! Z" z
ns_marquee.left=marqueewidth+8
5 @+ s' K! H. _+ r8 D- P+ Wns_marquee.document.write(marqueecontent)
1 b4 `/ _2 T5 O! ~0 }1 pns_marquee.document.close()
' l9 d+ m) y* f& m$ \actualwidth=ns_marquee.document.width
3 F- y6 @; ?# d" ]}
  f" l6 I3 A2 h; L% G* w5 q2 Alefttime=setInterval("scrollmarquee()",20)
: X& B" i# y4 d  `$ M}
# Q3 C3 j8 E& L) {1 C+ t7 nwindow.onload=populate
9 P; e* j$ p' c* s$ r+ g
& a' E$ I; D& Zfunction scrollmarquee(){' W* b& J" o' B; p9 z. G9 b
if (iedom){
( r# @' W# `: y) D5 Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 U" S* Z/ k5 v# j' n& P: f% O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* `/ w# P- K: o: l1 C6 zelse2 r" f9 E9 E% w5 R/ Y) K; C6 |, f' {7 w
cross_marquee.style.left=marqueewidth+80 m8 Y& }7 o4 `8 O6 E1 O, h% D% m9 D

1 n& J3 W8 ]9 B! p( ]# r* n4 d  e4 [}
& P; k. M2 n" h, Telse if (document.layers){
( `; [" B8 y* H; X5 tif (ns_marquee.left>(actualwidth*(-1)+8))0 U# Y7 D' d) y. @7 O4 C
ns_marquee.left-=copyspeed
- G4 M; t7 D" C* Selse! x& u5 R4 A) ?$ e5 h
ns_marquee.left=marqueewidth+8* P3 M# o- g: F4 t$ v9 Z
}4 P( b  G; E* g3 B
}
2 y# ?4 F4 h9 N7 K0 z. V- x
2 m% P! H0 D  I: u9 M, Dif (iedom||document.layers){
! c4 O) c: }3 _' r7 kwith (document){; q: t. Q* w+ i$ K, i( g2 v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 a' r3 X! z! K9 `7 z: Bif (iedom){
- I. O" }* `' v+ ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* x/ F. S: D3 O: W8 e. X- u& z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 Z$ c) H3 G* S0 ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# q6 \. A; b) w) J  n' R) [write('</div>')
) z5 A; s: s1 `( T. T}" T2 S. x1 Q5 C
else if (document.layers){
$ U+ u: L: x1 K) `+ N$ H+ Z! Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 v) h# y6 U- I& Q& x" u; gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 S$ L- u8 O  x- b5 P) [write('</ilayer>')( ]. N# O4 ^- p; A6 ^- l% m
}
7 D. C! t; \) zdocument.write('</td></table>')+ `  }7 F1 P* c, X# u
}' _) c0 Y: }6 R& t# G/ k
}
/ J* e! _  ]+ j7 e</script>

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