返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ H5 ]) E) S! k+ nvar marqueewidth=3000 k8 ^/ \: I1 x6 |
//高度: y& k9 k" `" I( [8 G2 v
var marqueeheight=25
% G, h( }9 E7 k( v# h//速度(1-10)
+ ~+ t( w3 {( Y3 e) ]var marqueespeed=3
7 v3 b- p" W6 b//背景颜色
5 _: m0 w5 F/ c( Z) y7 Evar marqueebgcolor="#FFFFFF"
/ z) }5 ?0 q1 W. ^//是否能暂停 (0=no. 1=yes)?2 d; P- {: N0 c& {
var pauseit=1" U+ A# d; [) u

9 x/ ?/ B# c$ m" T* [1 X//修改显示内容4 Y& N9 \" s7 H0 e! c; @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 {  R' v/ }, g4 L/ o' l

! Q' O0 v4 x( m$ h' G' t
- u4 b7 x& @7 U5 i////下面不需改变////////////
' `# H2 y0 _! i5 G. }
' t5 F  Q  w; }( O2 Hvar copyspeed=marqueespeed/ B% L5 A* {9 u' p9 t
var pausespeed=(pauseit==0)? copyspeed: 0: x* H. P' |/ W
var iedom=document.all||document.getElementById. k' R) o  n1 d5 \
if (iedom)
2 }0 v! C4 _6 f  @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 e  `  B/ K& }7 t
var actualwidth=''
/ t; K( E" y# F$ I- f$ y4 r+ Bvar cross_marquee, ns_marquee
. |- E! t4 P; W( S; {
+ Q4 A0 W, b  qfunction populate(){
  ~- M0 M0 B3 [6 R- hif (iedom){
4 W/ G/ B$ z- mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& ^3 q) p2 X7 a( d0 Ocross_marquee.style.left=marqueewidth+8
+ Y" O9 Q$ a4 r7 X+ }cross_marquee.innerHTML=marqueecontent
1 c$ X" l$ g4 v/ [) p. H0 Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- C' Z. w! w( H9 r+ E}' [$ R' w; U5 n1 X! M; R9 u
else if (document.layers){
  Q! J2 \, L' u1 [8 F- ins_marquee=document.ns_marquee.document.ns_marquee28 X7 f/ q# d# f- X" M7 W4 ]
ns_marquee.left=marqueewidth+88 a* j6 i/ O' k& ]1 z; M& G# S; u
ns_marquee.document.write(marqueecontent)! p  j$ |& e1 n3 j" w8 @
ns_marquee.document.close()9 O% A) W: v. K" w$ X
actualwidth=ns_marquee.document.width7 T2 t& q  W) }# l
}
' h# A* l7 V8 R/ Dlefttime=setInterval("scrollmarquee()",20)! E9 O0 g& \5 G5 U( u# V
}
# U8 e2 j2 m4 dwindow.onload=populate
, v( J/ W- `# O1 c# I; l+ o
0 k9 i( ^/ k) K+ A, Dfunction scrollmarquee(){9 v: t- X% g& u6 |
if (iedom){" ]7 U. K% l" y- Y. q! L7 V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 A1 O$ n' D7 k2 T$ X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) m3 w8 H9 B' n3 t; F! {; d( xelse" z% H* ^/ z  N: ^2 h$ {7 S8 l0 t( y0 b
cross_marquee.style.left=marqueewidth+8
7 B5 h0 J. O/ w+ l
6 ]6 V+ B! g; n$ v6 [9 @}5 d5 I/ r4 p/ A+ @1 i
else if (document.layers){( D& g( x: x* E5 U: R
if (ns_marquee.left>(actualwidth*(-1)+8))2 F9 N5 C0 ~( O! a  S0 J1 m
ns_marquee.left-=copyspeed2 Q) M2 A' e3 l: t: I
else6 `+ c9 q& M  k8 c% F; s
ns_marquee.left=marqueewidth+83 L% u$ ~+ A# ?5 c
}
0 b; f5 Y- [8 R! l, Q1 |9 V7 u}
2 x5 B# j3 O! z* P8 c# o7 P( v* g' z+ J3 W
if (iedom||document.layers){
8 B: ^# d2 E% b1 P: q' c+ |0 twith (document){6 L+ Q  ^* Q$ D- n0 x- Z8 z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 J( ~) s& g0 d0 b4 Wif (iedom){. }. d  M1 u3 n5 ~6 @9 g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# V' {* g4 b( S7 d' Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, Y4 R/ T  c" L/ s- Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 X6 d3 X2 o8 T+ k  Fwrite('</div>')
$ A3 |, ^7 Y- T* o  T; N7 g6 r% d}2 I/ _2 [1 k, E0 m
else if (document.layers){
4 S: q/ H9 K9 f& t% d9 R7 Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 h: D8 }) G- ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 ]* [% j, }# A) v; A/ O
write('</ilayer>')) W8 B: }6 Y' x& H' p3 u' b3 M4 [
}( e" h  M8 q# p1 u, N
document.write('</td></table>')
. X; a2 _  @8 c  T, g& Z3 l2 D/ H}8 v( J( k4 v6 q3 f
}" g* ~2 f0 t( ^0 T/ B
</script>

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