返回列表 发帖

网页之跑马灯文字特效

//修改宽度; f# d) ]4 _- q0 s3 Z
var marqueewidth=300
: V/ h5 s0 |- {' O( `8 b  Q//高度. g' `9 H7 [  R1 }  V/ w: O; W! n
var marqueeheight=255 e7 y9 _4 _7 @; C: I& g- \. M
//速度(1-10)
2 L3 @! w: y/ c. o( V8 F! Svar marqueespeed=39 F2 q$ [' j1 {8 [
//背景颜色  p, C" T6 e9 |% O9 e) A/ E
var marqueebgcolor="#FFFFFF"
$ m5 t% S$ ~8 E# r. p2 m! z) o//是否能暂停 (0=no. 1=yes)?# ?' N7 g/ `9 \: t. Q
var pauseit=1
: _! B. {% ~/ V0 R: f
% P: B0 N% S8 Y* [3 y$ i//修改显示内容; M$ _( _4 V9 ?9 x1 Y! p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) T0 O- t( Q" y" Y
) ~9 m8 u8 w  k4 Z) P' K; D7 j6 i
- V9 B( y  B( ~* B( ~////下面不需改变////////////  B& z$ B7 a5 T) b" T' p, `3 z

1 v, i3 Z6 g+ C5 t+ I; I" Svar copyspeed=marqueespeed4 r$ N6 p# }/ _, {8 T. v  y
var pausespeed=(pauseit==0)? copyspeed: 01 y4 }/ m& Q" f5 s5 p8 R; X
var iedom=document.all||document.getElementById8 S% H; t% U/ Z9 i' h
if (iedom)
1 \% |% ?9 ]6 m# Y) Y. F" Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 l! b0 Z2 M* [  k0 R% r3 Cvar actualwidth=''
7 V7 P3 M# X9 J6 u6 q* Yvar cross_marquee, ns_marquee$ K. F& T5 r5 C9 \4 ?5 T$ p/ u

) l! B8 X) w1 Q, ?5 ?. mfunction populate(){
" z* z4 D+ o2 L! Nif (iedom){3 [* X) A! ^7 {9 o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 [6 u' z( W0 _+ x0 a# v  D
cross_marquee.style.left=marqueewidth+8
. [' |9 N% T: ?9 T1 ecross_marquee.innerHTML=marqueecontent8 b' R: W) k" U( b; F) ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  [0 K8 }, j; u! M! g}! P+ O0 f) D9 l5 m1 ^% L! w2 M$ a- E
else if (document.layers){
9 v0 k; n( V9 E# O, \' P) s) l; Ins_marquee=document.ns_marquee.document.ns_marquee2( {9 f- H4 x) j/ A: L5 F& R
ns_marquee.left=marqueewidth+8
3 V& w. o5 `3 u* Q$ z5 `4 V( H& {ns_marquee.document.write(marqueecontent)
4 Y. N" S7 w: o; c' Uns_marquee.document.close()
, \+ F+ I# M- D* cactualwidth=ns_marquee.document.width
3 m/ S! P: i6 |5 V}
/ J7 ?/ L% _$ k$ ulefttime=setInterval("scrollmarquee()",20)) l0 v, r$ V/ o
}4 S2 A, U! P6 n/ q1 q. d. _) _7 j
window.onload=populate& A0 m8 W0 l8 `, J+ Y2 U" Z- m
6 [. p* K, p! O1 `
function scrollmarquee(){, S: m5 n; f0 u
if (iedom){
9 p- U0 _( @* U+ Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- Y0 z+ T. |! z0 y7 lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* U# ^, J0 ^3 `" X/ gelse
( M) P5 o) F5 O5 H8 I% ~cross_marquee.style.left=marqueewidth+8
- L# t5 f5 q4 @- c' o" E9 M0 Z9 N7 F- h0 t6 Y# b
}5 S% }7 n) W0 G7 i* `. o& j1 L8 m
else if (document.layers){8 t* K: G/ f& ~, L9 N
if (ns_marquee.left>(actualwidth*(-1)+8))# b" @: a& u* `# u$ q! S* c$ H
ns_marquee.left-=copyspeed* K' Z  ?% ~$ B
else$ U$ T$ t4 B# q7 M
ns_marquee.left=marqueewidth+85 u' m' k6 M* I5 m
}7 z$ K" m& a, M1 @& P, ~3 @2 G
}
5 x8 V  @6 w1 P$ Q0 b  r
/ k1 {1 N/ w+ x( K' v( R% Jif (iedom||document.layers){" H: T7 c5 ~/ w8 z3 C
with (document){! _* _! O  }% @4 \5 T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: ^: M' s6 M  D2 Wif (iedom){
2 V( q+ W. n/ |2 uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). l) R! g" H4 W5 B" k+ x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% {; [5 r) `$ s7 Q; a. X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* R/ G6 A3 ]  U2 K7 B' H6 Vwrite('</div>')
( J/ b  d. T9 ]! H8 _) J* J}
0 Z& u9 J# x2 Q& I* u/ Uelse if (document.layers){) S+ w7 e2 T& c* f7 `) o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* j2 P$ c- z9 ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 d- U- }5 y& o% m2 I" Kwrite('</ilayer>')
! e9 J8 ]# p6 c7 d6 F}; `+ i# ?/ u& y
document.write('</td></table>')# k; a: e& J) p
}) B! M; E5 u$ j* E9 |  t; v, q
}+ s; s% |( c8 z& F2 B+ i7 j
</script>

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