返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* A. ^" n  A' O5 I* B. A, j! pvar marqueewidth=300
2 v. J5 x& h" }  u! l# S//高度3 t& V7 G+ c2 n( C5 A
var marqueeheight=25
& E( O0 }( F) m, k//速度(1-10)$ p; q; d1 q. w5 H$ W& I
var marqueespeed=3  m4 w$ h) p, w. y7 V
//背景颜色
1 c" F3 H5 |; r7 [% }  @$ Tvar marqueebgcolor="#FFFFFF"1 b& h, T( g; r( n: T" U# Q
//是否能暂停 (0=no. 1=yes)?, d- T: x( R5 s' X
var pauseit=16 u0 l: Y# a" z* ?1 h. S1 x

5 V3 R; ?8 f; E- Z% [//修改显示内容
% o+ n. l9 `7 ~5 V: |8 b& Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. Y( U9 C# d( j2 m
/ U+ e( [, u9 A/ j6 Q: c1 M$ O3 s9 S1 ?
////下面不需改变////////////
0 O+ ]# j; b. ~8 j
! M6 ^) h- P$ a. {! x. f. vvar copyspeed=marqueespeed
, a6 P9 C; e0 [/ _var pausespeed=(pauseit==0)? copyspeed: 0
! q% C+ c. p+ o0 n, e9 S% p9 _var iedom=document.all||document.getElementById. ]1 M' V. F$ q  B1 S( A" _
if (iedom)
, d* {2 n% V& l, N8 r* t- W( Sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 a' G! s+ h! L% Z
var actualwidth=''
* L2 t3 r) |1 S$ |7 Qvar cross_marquee, ns_marquee/ r9 Q& ^# J6 X: }7 v5 p
$ I9 Y  z6 T6 ?, b
function populate(){
1 K& ~& m% {6 k1 L. s; tif (iedom){% r# v/ O6 _: M& ?4 e  T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& |2 h5 M% ^6 U3 y) S1 {7 r- O
cross_marquee.style.left=marqueewidth+86 c" X* K! H! c* L
cross_marquee.innerHTML=marqueecontent
2 ?( g6 s/ P" {0 {, r- wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  r% @" g3 m/ H$ K9 @3 A7 Z
}
' ]% E  Q) f' eelse if (document.layers){' N( F7 k- N$ i" g; a( N& n
ns_marquee=document.ns_marquee.document.ns_marquee29 Y" k2 U2 \' z, ?
ns_marquee.left=marqueewidth+8
8 S" t7 A. l! B" ans_marquee.document.write(marqueecontent)
. ^1 h$ F; x. F+ n! K9 i' f6 Ans_marquee.document.close()( ~# m0 N9 T9 T- c6 |7 ?3 U6 M; I
actualwidth=ns_marquee.document.width
$ ~& V  b6 r$ N" @/ |8 [/ M- `4 a/ A}& N$ H! D  |8 l- B2 h) B; }
lefttime=setInterval("scrollmarquee()",20)- w1 X# I+ v6 Q3 u- ]6 J
}- t+ i% a: X* g
window.onload=populate: c" [3 w' s( B# K* t1 z3 B

, e5 I/ q  D6 z$ u$ Y! a% L! pfunction scrollmarquee(){
7 r9 s& D- `# p* B1 xif (iedom){
% A: o( K) D* y! {. G; S, Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); e: ]  J. Y& y8 k5 c4 t$ ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. C3 h  M  v5 e! B: l: s
else; i' _1 ?2 ?% p3 v
cross_marquee.style.left=marqueewidth+80 h  W/ Z4 z# i5 c. [9 u

6 O8 A) S% m) g7 z: M}
2 f2 d7 N; q1 Felse if (document.layers){: p3 D9 }0 Z7 a8 Q7 I! X
if (ns_marquee.left>(actualwidth*(-1)+8))5 c  [" Y! a, I6 Q) \
ns_marquee.left-=copyspeed
- z6 [8 D  v$ `6 s. J7 }+ }else! a- e5 k# m7 U# ~! ]: W; B9 j
ns_marquee.left=marqueewidth+8
* P7 {2 u* I* r, i6 g1 [3 r}
! B/ ]# n  F: ?4 ]7 U/ G}
. w, {6 R+ t+ A2 H( L; {. v; g& _
if (iedom||document.layers){
5 h2 @, c$ P+ J) ^) Hwith (document){% I) P0 x5 N0 M/ }3 M7 i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" p. g; }2 P# `
if (iedom){  s; Z$ ]' |! c% ~$ X" ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# V- t2 c7 O  b! iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 u: _7 @3 a4 g! p& j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): ]6 K/ h" q+ ~  |
write('</div>')
4 p6 h/ H' n5 O; J! g1 N1 e  }}/ `  ]+ X( v( j* k: m5 X; ?2 F6 ~
else if (document.layers){
1 o4 ]) Q1 F: t4 \- {8 L% p: L  Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% e7 ~3 Y9 f6 \' i8 p% y( Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 _2 e% O; a$ K; b6 N% fwrite('</ilayer>')$ m; S/ p# T1 b. g- _! C& i$ w
}( V3 X( S4 {1 O, w# u" Z7 S0 f& X' X
document.write('</td></table>')5 t1 F, w  S: V2 J
}
+ Q/ D# R2 A3 q# S* g}3 B* l$ C& U8 U  P. v* R
</script>

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