返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, @* D& g$ k7 p5 v- r* W9 z& @var marqueewidth=300+ {/ Y( K( S- T
//高度
: [  `5 N1 M8 Z" ~. W2 m4 c1 Yvar marqueeheight=25
) F& V7 i: @* W5 N$ Q( S8 M3 ^//速度(1-10)+ O0 C  e7 n" z( p7 k2 Q6 C1 F
var marqueespeed=3
( }4 R- i1 J2 s//背景颜色
4 L4 m& J+ b2 o! u' x/ Tvar marqueebgcolor="#FFFFFF"# E2 V9 }, Y4 n
//是否能暂停 (0=no. 1=yes)?
" s3 X- h; N6 y2 `- Q* J+ rvar pauseit=1
- w' o1 U$ c: H% Q
3 F, B: d& q, [3 e; ]- Q/ P//修改显示内容
7 a  Z( T1 }( w/ C) v) \var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' a) G$ y( I, b2 z/ ~
, l! c5 n/ H  K2 M2 l

) S& V2 x# `$ W  \' l////下面不需改变////////////
4 F. r; T4 ^& w, x) l. ~# U$ f2 H7 [7 L7 X1 r% H/ y: c
var copyspeed=marqueespeed
) t/ u1 J0 H6 v. _" Cvar pausespeed=(pauseit==0)? copyspeed: 0
% P  Q5 b/ U! \3 S: x) V' h* jvar iedom=document.all||document.getElementById2 z: |7 c# e- g- O9 \( V. I
if (iedom)
! j( h0 t* k5 n) }9 G) edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 r# F. J" Y7 c
var actualwidth=''
4 |% P2 ]! j5 U1 j) dvar cross_marquee, ns_marquee  Q2 I% `* G& n

8 n2 l" e$ ?' }- x2 _2 }function populate(){# e7 S% g) e$ K& h8 e
if (iedom){% g4 ~/ }2 |+ v% d- Z+ F7 V! `* B, u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 D9 _  U' r3 P3 N4 O3 b
cross_marquee.style.left=marqueewidth+8
. P" ^' E% H7 |/ n' Across_marquee.innerHTML=marqueecontent
2 H' C  \% F' C6 Y# Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ C% F4 e3 f2 n. A: E
}2 r" T# Z; r2 r5 o" F/ S: C
else if (document.layers){
# B1 o; t6 j3 A3 kns_marquee=document.ns_marquee.document.ns_marquee2
" L. h0 Y) N$ Tns_marquee.left=marqueewidth+8) H4 K2 I/ Q8 m3 }$ r% @" S
ns_marquee.document.write(marqueecontent)
! U8 g3 o5 R) V$ n7 g; U. sns_marquee.document.close()
( `& ^6 U- y# w  f! ~9 F- \actualwidth=ns_marquee.document.width6 h. a% k% S/ O+ E, K5 w
}
. `& F, y1 v$ N. K9 }( nlefttime=setInterval("scrollmarquee()",20)  ]+ S+ j1 l5 |5 M1 I& m, y
}
! A3 |+ t( X- _7 F( b" pwindow.onload=populate; t) z9 B$ ^- e& f6 x1 L

) M2 ^+ J: O  D' \; _2 K( yfunction scrollmarquee(){  n- J+ D' p8 d- M
if (iedom){6 m( S/ k  ?( H; N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 ?2 g. i( m+ X' L( N: B: s2 }
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 I! D: C" U& R4 B: Q: _1 felse' |3 N9 u+ c/ ^6 }$ Z
cross_marquee.style.left=marqueewidth+8
& u% d- v" l2 _5 r! [' E; e* a
  j- [& m" f+ ]  H, |( u}, g/ U( m( A4 h# v. L5 Q% N
else if (document.layers){+ F7 l7 e& E* g, }1 M5 K/ T
if (ns_marquee.left>(actualwidth*(-1)+8))$ X& O$ @: W6 }! N+ |
ns_marquee.left-=copyspeed% S' F& |$ d3 r0 x9 }
else
$ _- M5 {. o! Sns_marquee.left=marqueewidth+8( j: G8 }1 x4 @1 c; s
}5 U" {  _7 X' S. }  h
}( K* v; z2 d( ~0 M0 O% a
! h, k% O' e+ o
if (iedom||document.layers){
/ c1 {% ~8 v1 j' A! E0 I* V' |with (document){
8 \' p, l, x. _* Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# i/ _( ?' ?; L: v1 ~/ [7 pif (iedom){1 K) o! Z/ E7 `9 i1 X  s% h) f2 A
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 h0 u6 [) B( K+ T9 L$ s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& c2 O3 ]4 C8 Y: bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; O; \% b+ d/ X1 Gwrite('</div>')
! ~; Q) N0 z  O. J* N% c6 {/ {}
6 _( e: Q. A9 Q4 ?  V( qelse if (document.layers){4 g+ t& k: l! L+ R8 _* b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 W- M" h+ B  [' f, qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( D% y7 A3 Y0 [, e3 B. B% i
write('</ilayer>')
  P- m. r2 W: i' P4 @2 |}9 g& {2 s5 j' R: Y& e4 h& X: X+ Z
document.write('</td></table>')
& y/ b5 }$ m  y( h% ~}% K& k, w' ?0 _0 W2 G, G
}8 \: f1 v3 C- K+ _
</script>

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