返回列表 发帖

网页之跑马灯文字特效

//修改宽度' @* p3 b  @# |% ~% H
var marqueewidth=300
. L( X; e! R! G5 S//高度
) v! c( C" V% `var marqueeheight=25* ^2 h: J5 g  G3 M
//速度(1-10)$ e" G! l4 b1 I) V0 l
var marqueespeed=37 h) M4 c9 s# t  ^- G! d, y
//背景颜色5 M; x8 n- J8 q& F. u- f) _
var marqueebgcolor="#FFFFFF"
; x/ i( ^/ C% n  N1 `! Z' s2 Z0 k2 S//是否能暂停 (0=no. 1=yes)?3 D- h, y( S& X; e- ^7 r( B" b
var pauseit=1
6 n! A6 `' u9 O5 E' F% l) L; K: h
9 I8 [5 N7 d  m+ ~//修改显示内容
- s8 M$ k/ s( n$ d1 {2 x$ Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 s' K/ r+ S/ e' g/ O
( K5 m& t- d1 d$ K1 u
" o+ H3 H* t5 c, a6 u  H
////下面不需改变////////////
+ p9 t' C1 S- Q& h1 g9 b9 g& }
6 L% u: s9 _' {+ mvar copyspeed=marqueespeed
( k! \8 f8 n6 kvar pausespeed=(pauseit==0)? copyspeed: 0
9 P. l" @0 G6 ovar iedom=document.all||document.getElementById7 i7 ]5 A( t0 B: u/ w, ]
if (iedom)
9 Y. E1 ]0 ?2 m: s. ^0 {document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, j; {, O  \6 T$ P7 R. i- m8 ivar actualwidth=''( a4 ]$ F9 k) [6 v8 X
var cross_marquee, ns_marquee% r% m/ y6 P) E0 A7 k2 u) D

  H. t- x! ?* s7 u& Ofunction populate(){1 G9 s+ ^# h; i/ |( \
if (iedom){
$ D( ]+ r0 T& v& L2 bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 y/ _7 p6 \# Q( |0 Y8 F$ T$ o, M- v* U' J  L
cross_marquee.style.left=marqueewidth+8: `7 i. |9 a$ u7 g
cross_marquee.innerHTML=marqueecontent8 P* N) r7 |" \2 W8 f3 S* \- A/ A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! s; g* [# X" r3 W: n. S8 W
}1 N$ Z9 c2 w$ g( O+ E, D( K
else if (document.layers){
( ?) @3 n/ [. }ns_marquee=document.ns_marquee.document.ns_marquee2
" l3 u1 F% e- S1 _ns_marquee.left=marqueewidth+8
* b. D- R; U+ h& p. {ns_marquee.document.write(marqueecontent)
  T% o0 @0 _$ x8 dns_marquee.document.close()
2 ?! D3 |: y* x) Z+ T4 Lactualwidth=ns_marquee.document.width
% x. M- u# o2 W; O; Z0 J}8 k+ @) V0 ]: p3 G; ^) w
lefttime=setInterval("scrollmarquee()",20)
% W% Q3 j3 y$ r* w: ^: t7 V5 Y}
" z' f, m' O3 |window.onload=populate
: c1 `3 `" M8 a, h
* ~/ H& E( I6 P+ V# J. c, t+ Zfunction scrollmarquee(){
9 I. G; C, ?. {" D3 {/ gif (iedom){
: ]9 w* ~2 f; lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( K. o) U6 W; Z+ y5 V- F& Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" Q5 e% }! b5 L* K; @' D
else+ Z4 M. I& Z2 t" {8 @
cross_marquee.style.left=marqueewidth+85 h5 P# y9 ~: O0 t3 D& P1 S! P
% L! P) Q4 C- N/ a$ G; ^
}
8 o" W8 R& i. w, ^6 pelse if (document.layers){
+ b5 P' Y; g6 H, X+ wif (ns_marquee.left>(actualwidth*(-1)+8))
! ~  }& s) `, uns_marquee.left-=copyspeed8 m& s1 `& f" [" U+ u, W7 S) U' e" U
else; q, \# z( J- v9 _6 R: x2 `( d, L
ns_marquee.left=marqueewidth+8  X  a# G2 [- n# D0 [: B. b) s
}
  ]) W7 Y2 w. m9 w7 u5 T3 q" U& p! D}% J) u# n7 S. g: V# o# X  l
5 @% h3 e8 q7 |- b! V/ {, N. I
if (iedom||document.layers){
+ z2 @6 Y; `% L% Uwith (document){
5 C- D# P+ G+ B* b5 B; L* g; udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* H& F0 V% b2 j. z4 `+ A$ E. sif (iedom){8 q: _+ B0 O5 y% U4 u8 h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& i' g% u6 Z+ ]  Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( S) n) k$ J* _9 Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), i# ~: Q: ^7 G9 B1 p
write('</div>')
6 L7 \! I$ f: t, f! C2 U& W}( d# I8 P% ?5 d" m9 I  h
else if (document.layers){
3 z5 F7 x! I* vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 Y; ?9 v* [: Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 v7 ~- K6 H9 H. F8 @5 h
write('</ilayer>')$ s( l1 p5 L8 \) x
}8 v3 X6 F1 q/ J4 T
document.write('</td></table>')
  e2 k5 ?, S7 s}
7 L2 r+ B+ _, Z- P, D}5 N' {! p; v: ]0 X6 _" u
</script>

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