返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 _, T6 F( P3 P! k  \% W( ?
var marqueewidth=3007 l, l" V/ ]6 ]+ P) [
//高度
, S9 n3 [! E) F" N5 f6 tvar marqueeheight=25& b! Q) {' p0 w
//速度(1-10)# W/ C( L/ s% D6 {/ a/ U/ N: x2 R
var marqueespeed=3
* Z2 y$ X  F) t  ?//背景颜色' }* L2 `  Y; a/ Y0 j
var marqueebgcolor="#FFFFFF"6 \( ^! e0 U& `# x( q" H
//是否能暂停 (0=no. 1=yes)?
# u5 O% [' X' H+ O: F- ?" Yvar pauseit=1* h, L8 n$ p* W6 _1 E* _

2 @! ~; A$ |7 w4 @% \' o//修改显示内容& A7 a  T2 d- F8 I' r1 E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 P5 V5 K) d: M; C% w# L

  r: H. J% N) j9 t8 J
2 _' {, k5 D; q5 R) {4 Z" O////下面不需改变////////////+ }0 M1 F" g6 y4 F# A$ J
7 k0 s0 U5 ?  V; P
var copyspeed=marqueespeed! C: \+ t4 Y9 ]  s) P5 `  P. s7 {! @) O4 a
var pausespeed=(pauseit==0)? copyspeed: 0
3 y; d% o  T' }- P& ~1 kvar iedom=document.all||document.getElementById6 u8 U, B- |  W  A1 n# B4 h3 ~
if (iedom)
2 f9 ]! a3 X2 _) w' @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" D9 x( A! q' @" N7 v( ~' xvar actualwidth=''
  t" d, }( C9 @( r. svar cross_marquee, ns_marquee
+ E$ W) ^, v; l
; f$ B# S2 {* ?  ~  h" R" l. [" l0 pfunction populate(){' v! N4 d+ |. O. `( w$ M3 o, z  }* ~
if (iedom){" f) z. \- n: U( w: v5 g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 r5 K- ?/ {% O8 J4 K4 h8 H8 ocross_marquee.style.left=marqueewidth+82 W$ \" C9 O  ~; `. C  P
cross_marquee.innerHTML=marqueecontent6 B$ |4 i9 Q) j6 O
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- {. L8 t" U4 D( S2 _
}! r% k2 x% n3 {* u8 Q0 W" f
else if (document.layers){9 E# B# p' X$ x
ns_marquee=document.ns_marquee.document.ns_marquee2
; I9 A7 [( E6 u: h2 u: C- cns_marquee.left=marqueewidth+8; N/ N9 f5 \: r2 N
ns_marquee.document.write(marqueecontent)
/ ^0 O) w0 c& f9 d; E& B, E! Qns_marquee.document.close()
' H# \" ?2 Y% G+ `3 xactualwidth=ns_marquee.document.width( H9 B& u* e6 G+ o
}
0 `! d5 ~/ x7 llefttime=setInterval("scrollmarquee()",20)! z7 {' V5 O# S3 d: E8 B) W
}
8 ?( ^2 l" G6 S1 l) }window.onload=populate, u+ L3 b3 K2 _) _
# p, Y2 @- t  p! `5 H
function scrollmarquee(){8 @. \  d" v0 O
if (iedom){; i$ a8 {1 W, ]4 e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 x6 r% s+ ]& g/ o( x  \3 r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 l) k; l7 b/ Zelse0 h6 G. v0 E# D8 i
cross_marquee.style.left=marqueewidth+8
9 F- k+ n" b1 x$ n$ U
" c* [/ T. ^8 ?" p+ z  e}5 w. g  @7 k$ O8 t3 @
else if (document.layers){
$ g( ^# v0 g1 `  X) _if (ns_marquee.left>(actualwidth*(-1)+8))9 B, c$ w  {% O, Y9 e
ns_marquee.left-=copyspeed
* P# t, E/ x. P9 relse
! |/ P* ^4 p. C9 L6 |) l9 o/ Bns_marquee.left=marqueewidth+8
" H. ?! L3 g- v  N1 L}
" C) h7 z0 m, Y1 u/ I0 w4 y8 }}
; e, g% a3 `+ n; X& e
. @# @0 T+ i, ]& F0 O4 jif (iedom||document.layers){
: M/ \3 K) o4 C5 vwith (document){
% d3 G) F3 x0 Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* D* s& E) p4 nif (iedom){
5 K9 h* }! M  b  nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 O. ~+ Z0 q7 F) X# r- |! k% z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' m/ I+ `" z$ [: B5 \0 q1 Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* h, I) Q0 W* P/ c5 Xwrite('</div>')/ L6 f/ l- B/ d- o
}
1 z5 r/ w' m6 ?+ `& _" s+ U$ ^else if (document.layers){9 z5 @3 n) C1 W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) r6 K8 f' T) O- d2 G5 W: Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 A( u: h9 N* K- b$ \+ [; Pwrite('</ilayer>')6 q# Z6 M% G# ?$ m* z6 M' F
}9 n9 M8 N# K" E7 W6 _& I) ^
document.write('</td></table>'); V  N& k# x  y% m
}3 h* \! a- r1 x  q
}
# G# F& J; c) T  @</script>

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