返回列表 发帖

网页之跑马灯文字特效

//修改宽度: [1 {2 e! X% Q' h- s. I. Z
var marqueewidth=300) K/ A: r+ n3 h
//高度
# D7 U" j* `3 R$ \  q7 w, V) dvar marqueeheight=25
7 n& |: [# L* H* U//速度(1-10)8 `+ b/ k% H6 L' u1 `8 C2 A
var marqueespeed=37 S& J: F% ~8 ]: U
//背景颜色  s3 L$ I" `: n# s1 d
var marqueebgcolor="#FFFFFF"- u/ e' g- \! \# d. H. f: H3 G
//是否能暂停 (0=no. 1=yes)?. E2 \4 `/ x& X+ W% }! h+ z# M
var pauseit=15 C  m! P; Y6 d/ ?5 h0 R9 M
$ E( }$ d9 f$ K$ o$ K% [  f) ^
//修改显示内容
, r: W) x8 [5 u3 Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: y/ @( I5 E# ?
, O; F3 q1 @" c+ [, S. Z7 r/ S8 ~( T* Q0 D! y, F- _
////下面不需改变///////////// g2 ^0 k: O: j

- D& @4 A/ L: m+ `: ^var copyspeed=marqueespeed5 g3 E8 l% k( v! v: D* r) i
var pausespeed=(pauseit==0)? copyspeed: 0: c. o) b4 _0 s. I( p# k
var iedom=document.all||document.getElementById
$ E% @3 z5 p6 p! [0 vif (iedom)8 i+ G7 n, G4 s* N# m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ w: L0 \% S( q( I6 a' B. [* kvar actualwidth=''
" w5 ~5 |, S; _- `6 {( s& Wvar cross_marquee, ns_marquee5 a3 w8 t" O' o3 S( B+ }  u

0 u( S3 E- M) j! o! hfunction populate(){: O" B4 Q3 c2 A+ b) o+ D
if (iedom){0 a( }) d: {- g4 N9 N% O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( d  N! Z7 o& R3 G6 s4 v
cross_marquee.style.left=marqueewidth+8
9 Q5 K- `0 D0 g1 Vcross_marquee.innerHTML=marqueecontent7 S; e5 j, p, Q+ w- F4 j, i; c# P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 [3 ]1 D7 y, Z( |1 Z( e# l  K/ d9 I4 @}1 H9 M/ E* g- ^9 Y# }1 m
else if (document.layers){) w. E/ ~1 I- w* y# ^/ ?5 v
ns_marquee=document.ns_marquee.document.ns_marquee2
: Y6 }* o1 i6 M9 k4 L3 bns_marquee.left=marqueewidth+83 i9 b# V( v6 [# v$ x
ns_marquee.document.write(marqueecontent)
  X) p) K3 b1 b5 T* p2 k8 ]3 y& Fns_marquee.document.close()% a- C0 I9 j8 v# s3 [7 h8 W
actualwidth=ns_marquee.document.width7 I$ }' J, `. v" W
}
# L0 h2 }/ V1 Qlefttime=setInterval("scrollmarquee()",20)
0 q" u" D! [& e$ X* I}/ _: v! m8 p- q5 ~7 `% c6 X
window.onload=populate; m0 z4 z/ K" z( \
6 F2 s) @3 q* g5 H/ C4 T# W
function scrollmarquee(){3 ]0 G$ i: X4 y- v( e  M% U
if (iedom){5 c/ Q+ A9 j8 [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 j5 r, n+ u# O: |1 G& b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 Y# _1 P2 X' E5 B% ^8 N/ H
else
1 B( m) i! k0 M/ u4 Z. ^! Wcross_marquee.style.left=marqueewidth+8" M+ c8 v- y( s9 Q+ a8 A

. y+ G8 q. N; L8 r7 w2 v) m2 Y}3 n) c1 f+ f/ t
else if (document.layers){+ c! \* f& }6 e. q
if (ns_marquee.left>(actualwidth*(-1)+8))1 A' E6 [" P5 ~" c1 q& s4 \7 Q0 U
ns_marquee.left-=copyspeed. i: v" @' Q6 C6 ~
else% P# p' I: P7 R4 o8 X) D, T5 z0 v' G
ns_marquee.left=marqueewidth+8
8 O5 y# |" l7 z2 [}" O/ u, s* y5 B$ [6 @7 G
}
0 a  t* c0 a; f  h7 p( L* w
2 N1 @  ?9 j6 L* l2 }. @1 i. h. fif (iedom||document.layers){
7 Z6 z7 _6 q. {% l9 r& c  bwith (document){; t% a4 ]* W. ]: b4 c
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) z% s$ j+ @$ v4 r& G$ W1 a" x) C! n
if (iedom){
, g3 y! V% {4 B0 {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, K& A& i, i6 @  M4 q# C* vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 Y" w, x3 O- P4 _  w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 n& f! \  L7 Y
write('</div>')
7 D6 o( |7 S1 a5 _}. X1 N" {+ w; q: b2 J0 t" G
else if (document.layers){" Q3 U4 X1 F3 y% \: i- a1 a
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 F  i  H5 W% O. d3 xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' m# j1 z* ~2 X3 n0 c: `write('</ilayer>')" F! i0 O$ f4 [
}! e$ l9 R4 C3 t! ^. V& u
document.write('</td></table>')
& p# }% j/ D8 |5 }/ F! ?/ p" v1 t8 H}  ~1 N4 @7 A% r0 r$ A! k
}
& ]1 A7 b% i7 D</script>

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