返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. ?: t0 `$ }$ t5 v" Nvar marqueewidth=300
" g, G% ]( c4 R# X//高度4 E0 V& c/ Z5 m3 J0 Z* m3 F- V
var marqueeheight=25. `8 x1 e8 m- ^
//速度(1-10)
: G9 p; n/ e/ a% u2 h8 Tvar marqueespeed=3
8 u9 w% N9 x; T. C) b//背景颜色
: }* T% b/ r! P; A$ `var marqueebgcolor="#FFFFFF"
9 \" }: b' q/ A7 ~' |3 [  l//是否能暂停 (0=no. 1=yes)?
& a8 a, R# F' S. jvar pauseit=13 `- c' F4 M7 [# V

6 t: d9 O/ W9 Q7 w4 L- ]//修改显示内容* v8 F4 _' t$ P+ ~/ P8 C0 s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ g2 z& T( @1 |# H
* h1 P: Y* ?1 J6 }8 e
& ?7 n2 j# J6 l/ U6 C7 T////下面不需改变///////////// k# m2 O* `7 ]! `6 J* K
" p. s- H3 q" t- d) ]4 j0 K
var copyspeed=marqueespeed
3 I3 F/ p# Z' Q/ Svar pausespeed=(pauseit==0)? copyspeed: 0$ G* s  r0 g. h. ^9 y) f
var iedom=document.all||document.getElementById" ]# \$ O  d3 s$ U
if (iedom)- {$ N! x9 G, A. {( N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 z  O+ i- C1 d1 \
var actualwidth=''
3 Q& Y$ N& ?. D) D: Dvar cross_marquee, ns_marquee; T8 ]2 l% P4 _

- z* L( @2 ^. X( @/ `6 N+ V" Rfunction populate(){+ @/ h1 t7 h9 D) s! E' I7 q" c
if (iedom){
3 L, N+ V  s; z+ s: U4 E( U  N3 Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( u* @; s) ]$ t$ P
cross_marquee.style.left=marqueewidth+8" ^3 w( l& S3 a5 E
cross_marquee.innerHTML=marqueecontent
9 j6 f4 u7 G6 z9 ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 G+ I. e- D9 \7 s9 T}
/ `5 B4 z. R1 w2 [else if (document.layers){
/ D4 v; \5 d$ y( T; pns_marquee=document.ns_marquee.document.ns_marquee2+ T1 n& V  I  A' U$ V2 ^
ns_marquee.left=marqueewidth+8
; X) r. ?; w4 Q/ Dns_marquee.document.write(marqueecontent)
/ G* R: d, x( s( Dns_marquee.document.close(); k( G% o3 A1 G. c' B# Q
actualwidth=ns_marquee.document.width
- i$ s' N1 p% y( \6 d1 E}
6 A% G9 i2 G) alefttime=setInterval("scrollmarquee()",20)9 {  k) d) c  _' |7 J
}
* d" w4 w7 B( M+ m( x) Gwindow.onload=populate
" ~9 D( ~" S. q# X$ s
0 N2 S, F' |5 H% c! U, tfunction scrollmarquee(){
: _: u* V8 Q  Lif (iedom){. N6 n& K3 W3 I/ n7 T! F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" z/ C/ v; d% T/ Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" z7 S- B1 p* Y6 L; e. ]% y
else* B1 C' [  i$ K
cross_marquee.style.left=marqueewidth+8
9 l* g+ _5 p3 U% [& [3 K9 b! ]+ }6 j9 C+ g" p# v/ S- i: K
}- F7 t1 Y+ |! M) Z* e6 @2 l
else if (document.layers){. O/ k( e$ ]* t
if (ns_marquee.left>(actualwidth*(-1)+8))' H/ \  U  m" W! n+ ?
ns_marquee.left-=copyspeed
: v) _; @) N& {- ^) `+ Felse
0 h; C( Q- j3 B2 [' N8 e* l* ?ns_marquee.left=marqueewidth+8
# ^  S1 z: [* T3 ^' i}
8 F$ N6 @- U: ^! q  X}! Q5 ?+ B' T) f
1 B0 `) d6 t* T! B) `5 P' B
if (iedom||document.layers){4 v' P& R0 W  T. J2 F" d: L( U8 U
with (document){3 P8 u% u  ]: u4 ~8 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; f: v( r0 @  L! [7 N! Q2 Rif (iedom){7 e8 U# Y+ K& ]8 W, |6 {- j7 V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 z' h/ w- Z( N6 i1 a8 g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 f# @0 y3 A4 n- C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ q" S/ }3 c! U: b  f' rwrite('</div>')
& g( n( N" U, S, f6 ]) A6 o7 I6 y}5 F; E+ A6 N& ?7 E
else if (document.layers){
2 Z9 H" N) @& Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 A( Q, ?5 @* H! I+ ^% W* L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ B$ ]- y- u8 twrite('</ilayer>')% |) l. c( r7 k% `* U
}
" I2 m" W1 _! g* l9 j- }# R2 Qdocument.write('</td></table>')
  \" N5 N5 C. z5 \' U: h}5 g! ]; V1 k+ F% v
}$ v9 e% ?( ~0 r
</script>

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