返回列表 发帖

网页之跑马灯文字特效

//修改宽度; @( A  `+ _: r( n( @, b
var marqueewidth=300. W! `% x9 ~' [1 z+ b
//高度+ {9 b+ ~8 x- c8 N+ W* x
var marqueeheight=25( a% ]4 j6 j* [( c3 C/ p8 s* h, U
//速度(1-10)
/ L7 A) }5 M, ?' }. y  L- k  k9 Bvar marqueespeed=3
& `$ ?9 ], b( V1 l3 A+ b+ V4 u; V- Z//背景颜色1 w4 J7 N* l+ u5 L
var marqueebgcolor="#FFFFFF"0 {* H: h$ B# f$ S3 @8 k
//是否能暂停 (0=no. 1=yes)?
( R% Y! }5 L/ \2 j3 s" o7 Ivar pauseit=1
5 `% u8 r3 Z# q+ u: ^
/ E9 c( u2 ~& R8 Y# T//修改显示内容# m; B3 ~/ K1 F, {8 R5 v3 L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 C& e8 b5 B& W; G6 h
3 c& n9 }$ R  w9 l5 p

( T  c; C7 ~- ?, ]8 _////下面不需改变////////////
+ h# @9 H- C6 D9 L
' h1 O5 N. F8 t: V4 L4 U1 U! Bvar copyspeed=marqueespeed
! V# H4 F2 R0 A, {& Z3 tvar pausespeed=(pauseit==0)? copyspeed: 01 q( F4 }1 Q6 N
var iedom=document.all||document.getElementById
* D: [6 e6 E2 m! T. ^# [* E0 xif (iedom)
  m% Q5 g1 r) B/ i6 D+ vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) \2 S1 d2 t; F8 o, l" L
var actualwidth=''
3 Q" w0 p8 R3 M" yvar cross_marquee, ns_marquee
  E4 l" Z6 {& K! |3 {& S3 V
* Q7 Q0 X; G# a8 {6 x# x: pfunction populate(){
8 `1 Z7 q- ]: L5 s9 |1 j1 U  xif (iedom){/ ~( F1 S$ @  ~" {4 M$ h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' a" U2 f' K% [: q2 j  \
cross_marquee.style.left=marqueewidth+8
( ^8 ?/ C7 g& c+ e4 ]& Y  P% z$ Fcross_marquee.innerHTML=marqueecontent
+ R8 y0 b8 G0 n2 Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ n$ f' Z' g' ^; b) p5 Q}
- b4 G6 D  N8 y3 q$ A0 m' uelse if (document.layers){6 ^' q; S( G. f" u& ]3 `( X
ns_marquee=document.ns_marquee.document.ns_marquee25 ?2 l/ X% a5 d& J
ns_marquee.left=marqueewidth+8# B: g$ C8 Q$ ~+ P2 _' G4 B; _
ns_marquee.document.write(marqueecontent)
+ h  L; ?8 g) Xns_marquee.document.close()
$ O: F: X5 q/ f( U. \6 Eactualwidth=ns_marquee.document.width
! O* _' j; h' c% d/ B" A6 Y}
( c2 |+ r# P! N, F5 alefttime=setInterval("scrollmarquee()",20)
5 q5 h# }3 o/ `}
1 R% k& _, T) W8 ]) swindow.onload=populate
" Q! W. Y7 z4 m$ E- A* K6 r
+ R2 d7 s. l8 H& L! mfunction scrollmarquee(){! c* v( z9 I+ M, @
if (iedom){" f/ C) C3 z' |+ P- E% E) B
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 ^( B' {, H) B. X- f% D  M0 }1 D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 w* T. D4 O# J, [# H# e5 L+ b
else6 u" c# G. n, C! \- w% L- n3 B
cross_marquee.style.left=marqueewidth+8) d/ Q" [2 `/ p7 p4 T) ~& p' q
6 t* n9 y9 ~) k/ V# u4 Q( ^/ Q
}4 N6 J# w! S9 c2 p/ Q3 G
else if (document.layers){
- @, E/ ?: m3 R9 D* eif (ns_marquee.left>(actualwidth*(-1)+8))
  @# G7 p; Y! c6 lns_marquee.left-=copyspeed
9 K8 Q2 f0 p6 \' T) f0 Qelse, Y5 C, I. j' G. `* ?$ Z
ns_marquee.left=marqueewidth+82 V4 Q' J. [) P5 U  W5 a3 j- K
}# Q" H1 M$ c1 E: h3 m% Z
}
. U2 G5 \* v5 ?" `, d$ k9 a+ j) J+ t! M, H7 }! [% ]
if (iedom||document.layers){
! s7 ^+ |# X& _! \: Ewith (document){
9 T+ Y7 U/ g) L* T+ jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 ?. k/ E4 V5 z2 x9 q) y1 G
if (iedom){. v1 o6 U* M$ T8 d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" u8 H& B1 G. Y( ~9 h0 r2 t7 f* u5 t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 \$ B4 Z/ Q1 U* K, i3 R$ rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& S' l- l& z* z! x- [+ p! Fwrite('</div>')
. V1 O' G# f/ W) N+ y}& {. E# K3 }0 E6 g6 X9 Y
else if (document.layers){
; P# z7 @! u+ Q9 i. q' owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( O3 Q4 ]0 P: [5 _$ n9 o
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 J8 B! o0 @6 c) d# H% I
write('</ilayer>')) ^7 x( H2 E# d
}
, `( _' k3 I; ?document.write('</td></table>')' W) u" I; ^1 L2 e# A
}. V+ N2 y' w. R2 e. C) r# K
}
' _' a* Y7 A! [1 @; a- r1 n/ Q</script>

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