返回列表 发帖

网页之跑马灯文字特效

//修改宽度% q4 e' ]" O; ^
var marqueewidth=300
* w2 Q0 q. a) a6 z# d$ M8 J7 ]//高度
) ^1 M( H( Z. F3 \; cvar marqueeheight=25$ z% `5 |. E" j6 c% L
//速度(1-10)
4 S" J! k1 ^, T6 j8 evar marqueespeed=3
0 Z, B4 @: z( R5 g//背景颜色
1 T  m! b& x1 Mvar marqueebgcolor="#FFFFFF"
  I+ K4 ~) D" _: h' D& I//是否能暂停 (0=no. 1=yes)?
" ?9 |# p: T1 e1 x+ kvar pauseit=19 _, ~* B+ O" W' S2 E- B3 w5 G

. O5 f, m6 i8 V/ I  x6 e//修改显示内容
% ^' ?2 X1 {5 V/ C( P; K6 Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 y8 V' ?! F* v- N& h
0 a; M+ H. X' ~& R7 ]/ q* v! b0 P4 i& K8 Q, f  A! D! C
////下面不需改变////////////
8 W3 b# Q2 X- G4 W1 _9 G( H
- H6 ?, L4 v, X: yvar copyspeed=marqueespeed4 p: b6 t9 d1 N! l! M' u
var pausespeed=(pauseit==0)? copyspeed: 0* G- [/ A( ?; r* U; H4 d
var iedom=document.all||document.getElementById5 z( `" s: g/ s) ]
if (iedom)
) a7 [. E* O" ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 C2 R; N. C. ~3 b3 }7 _
var actualwidth=''
9 T/ ]" C5 N# q6 ?5 e- svar cross_marquee, ns_marquee
7 Z' Y( B( b6 e' P% P; }( X
$ G* z* w4 K, k5 G; Rfunction populate(){# t/ |2 Z4 d$ X: _. ]
if (iedom){- a+ {, H8 e% }1 J' P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 o) ~. u) @5 l  a) ~# dcross_marquee.style.left=marqueewidth+8
3 u6 @' Q9 q) O0 t; u' R2 t9 p3 }cross_marquee.innerHTML=marqueecontent9 O; s5 B$ r  i7 x1 n$ u) i4 ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- R9 p. ^2 N6 @2 w# `; ~}9 [; J+ Z+ t& Z4 P/ e" d7 D
else if (document.layers){# d2 N! A9 q4 L0 |: t1 r
ns_marquee=document.ns_marquee.document.ns_marquee2
: Q/ F( o; Y# H$ B9 [ns_marquee.left=marqueewidth+8, i$ E2 [2 a: Y/ p9 E
ns_marquee.document.write(marqueecontent)
2 l) F8 E0 [5 q, z7 pns_marquee.document.close()
, e4 J" M% l* P9 ?& {actualwidth=ns_marquee.document.width) w4 i2 g+ u, Q+ N! q  V
}
  @8 w' ?( h. C# i* W0 clefttime=setInterval("scrollmarquee()",20)' B4 J; }: ]/ A& ?0 Q" O. m) _
}  {" |+ z: P" o
window.onload=populate: Z% m0 h- w5 O" {- d8 r+ ]
+ I. Q9 L7 P" X$ Z8 f
function scrollmarquee(){) _. A; M. o; m( N2 v
if (iedom){  C4 R5 B. g$ b8 [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ j9 z0 k$ C- t9 I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 y) ~  i' Y2 relse! z: h1 i# _5 U8 V* z
cross_marquee.style.left=marqueewidth+86 m; [2 h& H. n4 Q7 X0 u

) B* N4 t/ i1 A" U3 Y; ^3 {}% N. z  {& G  A/ j7 |
else if (document.layers){6 \8 f$ Q6 O$ Y" a$ ^
if (ns_marquee.left>(actualwidth*(-1)+8))" h$ S  ~4 Q8 W) e, ?
ns_marquee.left-=copyspeed
* J3 T" Q) P# R6 x( n# m) ~else
1 G/ ^3 G  |2 z( |5 a9 Wns_marquee.left=marqueewidth+8# f3 I3 D( t9 Q" B6 F$ o
}
1 V2 t" L. y9 S}
$ j! X# b' K5 p$ C1 D' H* k' e5 M  H
if (iedom||document.layers){
* w+ f, S' K; A' \5 H5 g8 ]with (document){( c$ M0 b$ g' u6 H- i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* }* i9 @; X; Lif (iedom){
/ e/ a- D$ V( d- B7 qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& X* i$ y( \! J9 V" g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 J; g$ ~/ g2 u+ Q; o$ Z9 g8 L, C. _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! p( `5 {: y0 f1 M" @/ Hwrite('</div>')1 Y" O, Y% W" r& k, ?$ g" E
}
. R# [6 s* p& s& L' C8 g( F) Helse if (document.layers){* K) v: x/ J( Q# k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& k* d8 H3 n" B, P1 N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ j# w7 f- C0 s9 H  [9 ]
write('</ilayer>')/ m8 I  f; i$ y( _' E
}7 j" F- F0 O  p9 z0 T
document.write('</td></table>')0 {" [& ^& d' C% @3 C+ X
}  D9 B) p7 O; N  S- p3 p# j
}0 g$ u: q, h7 c1 \
</script>

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