返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ z# T% H3 Y+ r# P. j4 f, Ovar marqueewidth=300
: R* I( Y  G. z2 k- D//高度' ]% ^& M# Q5 b0 E6 b
var marqueeheight=25
1 v2 x$ J. h3 }8 Z( z1 ^//速度(1-10)
; w& A/ s8 a- F6 H2 U7 T  qvar marqueespeed=3
3 ]& @' _9 u% E0 F: N7 d//背景颜色
9 B; Y7 L1 U( b) |var marqueebgcolor="#FFFFFF"& A' o, D; `4 x! n* o
//是否能暂停 (0=no. 1=yes)?8 f5 |3 f$ \1 d: [, [
var pauseit=18 N: I  s9 `- ], j) i+ y7 ?
& o$ @2 O$ `, J, o, F* |
//修改显示内容
1 ?+ P$ f! O7 l" M7 h7 F) J) Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; O, p: h  F" [* y3 O, Z% D

6 d  b: s& f, `2 L2 S  L( @& E
$ A/ g: G% K1 ?0 Y4 I$ h/ b: k////下面不需改变////////////8 @1 X, f* u4 y; u$ M4 \: ?
+ D$ B8 N' b. Y5 x/ @! c" u
var copyspeed=marqueespeed
2 r; Q: M! V  _8 V& d9 C7 tvar pausespeed=(pauseit==0)? copyspeed: 0* Y9 Y0 C4 L) k; s; a/ V. C
var iedom=document.all||document.getElementById9 X) m5 i$ E- z
if (iedom)7 i  c( W- t! y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ Q2 h7 h9 j( T3 v: Bvar actualwidth=''
% `; c, a4 H: I" @( ]: pvar cross_marquee, ns_marquee
0 a8 b% l3 y8 Q. T2 C3 f# e' q. M+ x5 i2 Y, C
function populate(){
# B" a3 f& ^+ B  k3 Cif (iedom){7 p9 z- S, Z& o! Z  Y+ z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ K; z$ ]" i- h* D9 k4 fcross_marquee.style.left=marqueewidth+88 _) ?' s' S! U& H& ~
cross_marquee.innerHTML=marqueecontent9 c4 D0 u8 G  B- [. I8 f) _6 a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& s8 [: L% W& l3 I) m6 w/ a
}
+ `, I0 O$ H! z( A* d  ], Ielse if (document.layers){: C5 s0 F- h9 y. T6 M' K* ^
ns_marquee=document.ns_marquee.document.ns_marquee28 v3 V1 A" k2 Z$ `. f. u
ns_marquee.left=marqueewidth+8
& u3 \& w9 i9 X. S7 Zns_marquee.document.write(marqueecontent), s6 {2 m0 `/ h- v$ h2 R2 [
ns_marquee.document.close()
% t* [3 l7 J. p8 ?* P# z3 {9 gactualwidth=ns_marquee.document.width  n, ?4 O& E, ~) D$ G0 ?" ?
}
3 V( R* t; s# K0 n7 j4 ~lefttime=setInterval("scrollmarquee()",20); m1 a6 h0 y8 E; T
}; t, ~' @4 F5 G  [- n
window.onload=populate
( ]/ }8 S9 E. [& d$ X$ ~; {  t2 r/ S8 c/ m" O5 G; o* ~
function scrollmarquee(){1 j6 n3 G( }1 S, [2 P% w1 j
if (iedom){7 T& p+ j  n7 O  C4 G) i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), ^) a7 n# s1 {7 Q" ]# t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( R' v4 i; `3 p3 Y4 N% E
else* C  `. O* ^- C
cross_marquee.style.left=marqueewidth+8
& f. `* G1 D9 C& L4 F. E% }% v" J9 r9 k+ I
}
. M) Z4 f; p, T; R+ g" e  G& `/ Selse if (document.layers){+ x7 S, N+ c4 W5 [8 f9 u" B/ D/ m
if (ns_marquee.left>(actualwidth*(-1)+8))* ?: F) I5 I! B: h
ns_marquee.left-=copyspeed
( m& d9 P& b0 v; k' Z- yelse
- R2 A. k' O5 Z" Z/ C9 R3 U. x4 [! nns_marquee.left=marqueewidth+88 J, w- B; N5 G, k
}  z4 `2 z* w% W$ A9 _' S
}8 I" j& y) J; U3 K3 X7 Z+ d

+ \: t) z% f$ Jif (iedom||document.layers){: I- u1 k5 x5 O/ |; ^1 K# ?. P/ H; o: W% q
with (document){# r$ z/ H8 s/ s9 ~! Q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  ^; ]% v% e* B* n9 iif (iedom){8 `% `; g7 D1 L4 n/ O& S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) M+ I$ ^5 f& ~! ^* D% Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 T. r0 L2 w; r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 {6 a; t/ O/ h3 c
write('</div>')
  |5 j, r# j; t! B5 k}. `. j+ F! _% o% M" I
else if (document.layers){- v1 l, W* B2 d5 j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' }$ s. |+ J8 r8 Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  I. W1 r# S% K
write('</ilayer>')) {8 ]  D$ `2 |
}
8 B1 H; J; ]% ~' H  A% z) tdocument.write('</td></table>')3 g6 N& k0 G+ h5 s
}
5 A6 v' q3 g# m, j: W2 v}
$ I& U# @1 j& o1 G: a- m</script>

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