返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 c% o: z  C& @) z6 E/ W% B. m' t" rvar marqueewidth=300
4 E2 P8 b# ?/ \7 E: W//高度" J% U0 c1 Z" p6 d0 k& p7 e
var marqueeheight=25
0 i! l3 e5 `; Y' j//速度(1-10)
. v8 }" H' `# Svar marqueespeed=3
2 s, E+ L5 |. P3 d9 s) J. o//背景颜色
  E/ \6 H5 J7 T  xvar marqueebgcolor="#FFFFFF"
5 O% }" ]! h! l" ?5 }2 {% `4 R//是否能暂停 (0=no. 1=yes)?
- M7 m6 b. I, t. e; d; G( o2 @& Gvar pauseit=1" S( j& O, i  B  f( a) T0 B1 `
+ k, L' F8 J. m( F9 c
//修改显示内容
# m: p/ L. x  t- cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  d) v2 [# j# k: F9 [
% |+ R" }4 z% b  @
: @* }( X( ]: p( B
////下面不需改变////////////
0 ~( p( ~2 s# l* M* u' T1 C8 l: z/ {$ A7 A2 s$ m, N
var copyspeed=marqueespeed
! p% v! g) ?3 I2 C4 Gvar pausespeed=(pauseit==0)? copyspeed: 0
7 x9 y: Y6 @- s- N: wvar iedom=document.all||document.getElementById" y; y; x" [9 l2 Y7 s+ R: J# e" n
if (iedom)$ }0 ~  p- \% h& ^' H' k* S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) Z6 d( D3 d8 m1 W
var actualwidth=''. T. B4 S8 t6 h" f0 T9 c) G/ V
var cross_marquee, ns_marquee* [' H  M4 E4 w: C' y' q" Q
. F% W/ `' ?' f
function populate(){) d' ^+ E- t; h/ Q" [  W! u, l
if (iedom){
9 y( a( h* Q' h# tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ s! j9 W  h, k1 H4 N# g0 V$ x
cross_marquee.style.left=marqueewidth+8- ]' u; Z1 J" _6 J  }* {) V
cross_marquee.innerHTML=marqueecontent" X/ O, O- }; k! {; V9 a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% m5 Z) a" B, q5 H- a
}: Q0 W- z4 L9 c# K* V1 H9 @
else if (document.layers){! v1 O& [$ U% P5 u9 z' p
ns_marquee=document.ns_marquee.document.ns_marquee2
" E4 n+ y! g0 I5 S. D0 u! z4 fns_marquee.left=marqueewidth+8& C! x! v. J( Z
ns_marquee.document.write(marqueecontent)
6 I$ g; A5 `9 q, V: {( _9 t$ mns_marquee.document.close()
$ D) q0 k! n% l0 i0 e* y; |' G2 Hactualwidth=ns_marquee.document.width$ X1 L6 e2 v) p6 d6 W) o2 n7 z  b
}
: v  _3 ?3 P- vlefttime=setInterval("scrollmarquee()",20)
2 u. n  W) t* d  o4 y" N}8 m4 z6 C: Z9 E2 S, |7 T- _
window.onload=populate# `- D, n) E. q2 ?

  p8 y8 T! K# K' nfunction scrollmarquee(){
. `6 c" {6 W" U$ s" qif (iedom){
" n$ f5 `  n& uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- W* i3 t, ^% U2 jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 d& `2 n8 a3 r+ f
else: d& x* t  P1 x; K
cross_marquee.style.left=marqueewidth+8' e7 ]. _) h$ X! m; a

! ~, u; K- n8 F- q. B}
/ {( H: P# e- ?" w/ Velse if (document.layers){
7 {+ h9 D2 S7 i) `1 t2 gif (ns_marquee.left>(actualwidth*(-1)+8))
) O6 r1 O. |' X* J# ons_marquee.left-=copyspeed/ [& Q/ v3 E& Z0 N* p* n; j
else
( Y3 l  B; Y" b" [ns_marquee.left=marqueewidth+8
" h( J" b5 R' |4 C: F) z* h3 p}
  N- |1 j/ r; n1 K1 D/ Y}5 ^2 g7 t* Z* ^. W

+ \8 _% r( a) c# y5 D- oif (iedom||document.layers){
) Q6 s/ _: `4 w0 Kwith (document){
3 |8 K6 x) e  Y- t7 z7 F( Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ t2 }# y% g8 S/ B8 C3 h4 P8 p/ wif (iedom){
( T! N8 L3 q, E* Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" j4 C  I+ S( P. d0 m! P& s9 g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 B7 J  j- j* d9 T* c" {- m8 D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ a7 A$ B# w: b: Z# Pwrite('</div>')2 m; I2 o! T; N4 U% |( V: `
}
. _1 Z" ]6 ?; X! \; c* nelse if (document.layers){
+ O& k! v4 B' fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ b. O8 A4 l/ X9 B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- M; s0 R5 I+ Iwrite('</ilayer>')
0 s6 A' y. a. i- j8 @}" X$ G. E( f# F, d
document.write('</td></table>')0 H4 o: @; J& l/ t; \( x% s" b7 R3 \3 T
}
; H- R5 f; H. }+ g' H9 x}
- t+ g& a- z' E5 [</script>

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