返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 q7 F, R, J8 {1 ?. }; o! T
var marqueewidth=300
# e/ B6 q) z: ^% o8 S//高度
5 F6 H2 s# j5 @  C7 `4 Ovar marqueeheight=25
2 |! Q$ o" z+ E: z, q; E, l  W& ]//速度(1-10)0 H/ W. w4 E! H8 @) F2 Y
var marqueespeed=3
/ @, C& i, k7 h4 l, r. g: z% P+ Y) h0 N//背景颜色8 Z1 E/ j# w3 o: M% N. ]; c
var marqueebgcolor="#FFFFFF"& z& V2 M! U: \7 K
//是否能暂停 (0=no. 1=yes)?/ o# C* @7 K& ]% S  ^
var pauseit=1
5 C1 d5 w* G; _. `8 H: ^( n& l
, @. k/ _: _8 J6 q2 N) k9 |' ]! ]//修改显示内容! i! U: v+ ]3 f( z2 p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', X- l$ R; p3 x

  m/ j3 |0 }& D% w% Y0 D; X1 A0 J( _; g# ?' }8 G2 e
////下面不需改变////////////
7 L( ^7 D7 N$ E' k4 y
7 h8 _$ a5 E# {8 T8 B- Qvar copyspeed=marqueespeed. S$ H- \8 f4 _9 d8 T. U5 D* v
var pausespeed=(pauseit==0)? copyspeed: 0, J; e" \, P( J' K9 ~+ @- K$ g
var iedom=document.all||document.getElementById+ F" ?; B  V! P4 l. Z% C6 a
if (iedom)! Y0 H+ P8 i  f9 {3 }$ C! W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. p+ A& J* s* ]% b: lvar actualwidth=''% e$ y9 I: q* n6 C3 |+ K
var cross_marquee, ns_marquee
; i- D$ ]& A: B/ h0 O' \8 [$ n7 W
8 \2 {! @+ O, w! k8 xfunction populate(){4 p! z- n1 R" q& ]+ v
if (iedom){" P9 a. o. G0 z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, \0 B4 D. U' Z9 Q& _0 B
cross_marquee.style.left=marqueewidth+8
. l2 ?- _) i  g, p4 m: |) ?cross_marquee.innerHTML=marqueecontent
6 \! v" c( ?9 c) [; Q' A0 s$ D. mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  x& u% e# G& x
}  e) G0 z+ o7 a0 V
else if (document.layers){$ K+ {8 _" [- n$ ^1 B# E  T
ns_marquee=document.ns_marquee.document.ns_marquee2
( F3 @3 e, Y) Z2 ^5 _" Tns_marquee.left=marqueewidth+8
9 C. c$ y: f% I  w4 o' ^ns_marquee.document.write(marqueecontent)
: O7 c9 r. c( |" W) L4 Kns_marquee.document.close()
& u' C6 r; |; }actualwidth=ns_marquee.document.width" j( m! P4 f+ U& d5 R
}1 @; c9 I! E) v2 i- x
lefttime=setInterval("scrollmarquee()",20)
9 J( l2 b" _( F! u  }, C! z4 @2 |}( z! @- Z) n# f8 N, [. h& s1 b6 P7 O8 K
window.onload=populate% a" c, `) Z$ e& I

, F5 s' V% T- Z. y- A- B# tfunction scrollmarquee(){3 W& I4 g. F! X5 J/ f% p
if (iedom){# d, C+ u3 M- X9 M8 @) Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 o) X& y: k# T, K/ v* w, g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# ]# s( f1 B7 a" velse# m+ V* X0 \& b  ]0 D& Q
cross_marquee.style.left=marqueewidth+8
! M8 h# t( g' i5 M, n2 S5 s: K3 N0 Y. A
}( e0 ?- b, F4 G- F$ i9 O) W& Z6 O: `
else if (document.layers){8 J( M( _7 W- @! k
if (ns_marquee.left>(actualwidth*(-1)+8))7 \/ c4 `6 J- p4 a8 F5 F
ns_marquee.left-=copyspeed  d# s$ u' a4 @+ s
else8 B6 m, U& T+ K0 K0 }* h* _" [0 D
ns_marquee.left=marqueewidth+8" s( y/ y3 a% n% L: q- z# u
}
4 B3 F) I9 ]2 U}
; @& q+ I& U9 p# U* W
) x) `) Q' |" E  E+ v, uif (iedom||document.layers){& B( o8 u7 g$ j8 |6 K  m
with (document){
4 [- r- z9 L- b% |+ a8 n4 rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 l; @' o0 L/ I) z" d. pif (iedom){  U" O6 k. C. J* G! W/ s6 _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 v4 H( l" B$ Q. B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" u' N% U9 w6 {. r; K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! q7 O. @4 D$ H8 u6 j$ twrite('</div>')
/ I- M6 b/ b: h3 n3 W, ?}+ Y2 F0 `, ^! n4 |$ S
else if (document.layers){9 F# j; H; s4 S: b. C) A, z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 `: S' Q. W2 ~9 ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# U& U$ p5 u! ?$ w; Z
write('</ilayer>')
8 u4 r& J. c4 r5 I}
) l. M+ D3 ^' Cdocument.write('</td></table>')
, q# E/ s$ f0 I9 ?8 g  G) L}
+ F) t+ O! K& I' z  `1 V}
- f5 W7 x1 Y' |6 i* Z6 S# z</script>

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