返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( F9 k( {- G+ b/ S+ ^var marqueewidth=300
7 H" Z7 A" \6 O* V2 r6 m//高度
8 l6 R2 v5 Y- X, {9 o& T. {2 Lvar marqueeheight=258 {. d4 h  _* B* y6 C
//速度(1-10)
9 S9 d/ @9 w" D/ a& c8 [) svar marqueespeed=3
1 a# |' Q/ P! M$ Y//背景颜色: e. E: F$ x# Y5 W# g# i- D" n
var marqueebgcolor="#FFFFFF"1 H7 P  L; _1 V* Z8 k
//是否能暂停 (0=no. 1=yes)?4 i+ m& M7 x- S
var pauseit=1
' A9 l+ u4 I3 @  y/ i( g4 {
) i# e6 z7 L! ?2 _//修改显示内容
2 ~( c7 h+ M4 D8 T( avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 `, s' Y* S. p' g

/ @  Y. h$ ^8 K7 O0 C, M
* I# d6 \. J1 z& C; Z$ q////下面不需改变////////////
; j7 V; O* [) O! H0 e4 @! Y  G' {: k
var copyspeed=marqueespeed+ ^( w7 s4 H) y. k7 l( r4 }
var pausespeed=(pauseit==0)? copyspeed: 0
, B$ E3 l4 I$ C( _& a6 Qvar iedom=document.all||document.getElementById( e+ S0 M/ T: p' w1 A0 o; A* [
if (iedom)' q! N$ F# \9 [& e5 }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  I) X' u1 Z; D4 x% O, y! S
var actualwidth=''
/ x/ d3 B/ r; Vvar cross_marquee, ns_marquee
$ H6 `# P, e& ~% [" y1 f; b4 t+ O1 X  a  k$ v7 D9 s& E! R
function populate(){6 L! m# q0 x/ E1 ~5 u
if (iedom){
0 }  W1 W& n. d& k3 f, b# ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( v( K3 Y9 L9 Z% r# R# {. {/ |4 scross_marquee.style.left=marqueewidth+8
0 Z0 A8 p3 b5 Ccross_marquee.innerHTML=marqueecontent- t* V, Q# Z3 I; A/ b- i) \4 E! U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# h' T3 _. Z  W# Z  P7 h  P7 Y
}
- X! a% l+ t# helse if (document.layers){
+ V+ m7 [" u6 ens_marquee=document.ns_marquee.document.ns_marquee21 E% P1 K8 q# {" b! W# n
ns_marquee.left=marqueewidth+8
5 b+ A* X  @. L/ _( d8 F8 W& _5 Xns_marquee.document.write(marqueecontent)! s; i; E; l9 X0 f
ns_marquee.document.close()
, h+ o, k- p0 P& ]. P8 k  ~actualwidth=ns_marquee.document.width8 _7 r. A" T1 c) L
}" c& M6 [  B6 J, W1 q+ N. {
lefttime=setInterval("scrollmarquee()",20)
# k4 S1 _5 F% c. P1 s}
9 Q9 S. O! l5 a+ Pwindow.onload=populate) ^& C+ Y& B4 e2 V4 c, s" ]; T# a
6 G: ~% ^: r( C* M; t& i! O; m
function scrollmarquee(){
) N$ t' E6 a0 y1 k8 H" U. Z- u1 G) R& eif (iedom){
2 c+ |6 O, `) t9 b! lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' B5 ?1 E1 `' c, \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& ]; i/ t6 [  X8 E5 l: _) Uelse" ]$ g9 a) A9 J* W& z4 P* _
cross_marquee.style.left=marqueewidth+8
2 Z6 A9 e: t* ?! }8 b* |
% v) @. d+ S0 q  Z) x}4 V! X  n7 z) L+ ^. c) g
else if (document.layers){7 j$ I* v4 A5 ~2 s! G
if (ns_marquee.left>(actualwidth*(-1)+8))1 m8 ~- L+ |7 ?4 X" I
ns_marquee.left-=copyspeed/ O* ]2 h9 V7 C" r5 I
else
0 ^0 m  D3 i, B3 x' U2 R$ ^ns_marquee.left=marqueewidth+8
9 O7 H' |8 R3 A$ M}1 Z9 _8 ~0 ^7 h8 n: V) C
}
. y- ~6 s5 S8 C0 u& s1 a
( v9 `! `5 f0 U0 Y( q# Q& }if (iedom||document.layers){
, \2 z- B( G+ e; A( A( ~with (document){9 A, q6 H5 [# S6 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 g, ~: P6 T5 \8 X6 o5 Cif (iedom){
4 ~1 O& o1 F/ C. |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 X7 P: n: H2 j: x0 |& N' x1 vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- d8 a0 _. D% j% M$ a, A( ^/ Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 c! k$ d) G& d  ~write('</div>')
$ ~( ^, q. z% B/ }% a: F* }}
, m0 s2 G9 r( ]else if (document.layers){$ T- V0 D* n& A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 q/ \( j$ O- }) b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 N0 H: [/ R7 n: T9 Q; F
write('</ilayer>')
( I$ p  S8 q2 A" W}
" T  ]% O- q" `9 F, ?& d7 adocument.write('</td></table>')
7 w: h( r" j1 Z}) z* F: \4 P7 M; w- ^+ d" @
}6 _, h1 x  `) b* J1 d/ s: M
</script>

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