返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 U0 @1 x. o1 t% r4 L3 y5 zvar marqueewidth=3000 |; o' X3 H0 s5 |: x
//高度
8 N2 P" N  w$ w: o- t- \var marqueeheight=25
8 J1 Q+ |1 e) @//速度(1-10)9 x, \- B- `  V
var marqueespeed=3
! S+ E; |1 y0 [; S8 T  t5 _//背景颜色
3 A% X, c3 P5 P+ A! xvar marqueebgcolor="#FFFFFF"1 C1 I+ r1 ^4 z0 |3 m  a) {
//是否能暂停 (0=no. 1=yes)?2 Q8 ?- I7 U) u: {/ i
var pauseit=1" C0 p0 v. F( G* Q, h
$ k9 P3 w# x  k/ t
//修改显示内容/ f. H/ J; s/ f/ U" Z: O% R, o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 c7 l1 e# l' G3 q
, p8 }0 i2 u6 |" l
  `6 N  ~+ I8 M
////下面不需改变////////////
" q9 e) k& J3 k2 C# L
( }; O8 N( s* `( J1 `var copyspeed=marqueespeed
9 ~: b& E3 o3 B4 w3 R4 X0 `% evar pausespeed=(pauseit==0)? copyspeed: 0& [5 |/ N" g+ j8 y5 A7 i! }) `
var iedom=document.all||document.getElementById
8 R3 g4 C$ [7 i+ d& d) b: H  ]* Lif (iedom)
7 y: i) ^6 m4 }) d1 xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- C# }' ~1 I4 O! e( ?1 Q& p
var actualwidth=''$ @; X& s' g+ D& _. B* g
var cross_marquee, ns_marquee( a! W* c3 {7 A3 d) Y
3 N1 \9 F- I; Q* C0 c
function populate(){
  X6 T8 @! E* f" ]/ P, `if (iedom){
9 l0 Q  B) \9 f/ i3 L1 x$ lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ |: R, {; o" X
cross_marquee.style.left=marqueewidth+8/ ~' g& S6 J8 z
cross_marquee.innerHTML=marqueecontent
0 S$ n; m/ i; \: |actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ r' K' C) O8 A$ @# U* k$ Z}
: G' A: p* u$ ~8 d6 melse if (document.layers){, c! k8 i0 I, a+ ~
ns_marquee=document.ns_marquee.document.ns_marquee2
& C8 t4 V8 Z! u* }ns_marquee.left=marqueewidth+8
9 w% P; z1 K) q  Ons_marquee.document.write(marqueecontent)+ B" M5 V: L  A8 ]& o' b
ns_marquee.document.close()
( Q+ m% Q* \+ l7 Xactualwidth=ns_marquee.document.width
9 Z) l2 i  G$ j& _/ A}
- V3 b+ T5 Z5 S# f: klefttime=setInterval("scrollmarquee()",20)
5 u! A% {7 I$ u- }7 z- I}
! W1 T4 W' v* g& e! f+ _6 P) owindow.onload=populate
' i+ ]' y3 b! H7 W7 t4 e. f; \" m! @8 m
function scrollmarquee(){5 b' s% h6 H9 n
if (iedom){
. V  @5 c" |5 ?( }7 _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 O4 V9 e  }$ fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( _% C) r" @2 Z7 V
else
. J5 t7 \" d5 ^2 K. ?cross_marquee.style.left=marqueewidth+8
& l6 j8 Y4 O& K/ u) a- S( L$ s+ d' B7 S
}4 }$ i7 ?. Q& Z1 l; J& i& P
else if (document.layers){0 `; \. e5 O  j1 {
if (ns_marquee.left>(actualwidth*(-1)+8))
! q& e! P) t4 Kns_marquee.left-=copyspeed
# Z5 W# R; }3 D4 kelse
0 v0 _2 ^) B! Z  t0 |* ?) X8 y6 p) ens_marquee.left=marqueewidth+8
, }7 W- K; {( U  Z9 X8 e}
1 \& K, A$ R2 |! F' _}
+ Z3 u; N  z6 g- D0 M4 b
/ z2 T" m7 m. n6 W/ m; K* Nif (iedom||document.layers){
% A7 N! f4 K' |7 n" v  B8 b. Cwith (document){
' f: A8 a0 T8 E. K4 M: C. K: w/ Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 W* @( R3 c9 Y: Z* L$ x9 D) hif (iedom){0 d! K$ k# q. O. j' q) W8 X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% u# g6 m$ I7 U% b: z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 U$ ~* m. R- \+ Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 Z2 M/ a9 Z6 I6 N" m
write('</div>')! M1 C8 U6 _* ?7 y$ ?1 A
}
2 |- O% j8 r) ?8 F5 S* Qelse if (document.layers){5 m+ u+ j$ g4 a
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- D$ g+ |5 _% }. ^( D3 Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# g& q# @( [% ~8 h
write('</ilayer>')% W8 ]8 J' b4 K6 M+ Q! m4 s
}/ G8 g& W8 V2 x7 \6 }0 V7 y
document.write('</td></table>')
2 P, U8 V2 o% r' B0 v5 p}8 e. D- r$ o, Z9 |. \1 {" f
}
* ~1 i! h7 ^9 \5 v/ J2 w$ U</script>

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