返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% O0 Z2 U0 N7 x- z! Jvar marqueewidth=300
* G; F' H4 H' i3 ]3 S//高度
8 A( n( U( Q2 T& Xvar marqueeheight=25
7 X! b0 w# F. k& |% t5 _9 k//速度(1-10)* p# ]! s9 O- D6 f
var marqueespeed=3
3 i! U  ^5 E$ R1 K9 U# j//背景颜色. k  U7 Z$ {# y, S: @
var marqueebgcolor="#FFFFFF"
7 b$ E1 ]& X1 @3 s( K# t8 a  D+ z//是否能暂停 (0=no. 1=yes)?
5 q& c1 \0 W8 }+ Z6 g! vvar pauseit=1
) g( h% E( ?/ i7 Y. O4 y" P
7 y- {: k2 l2 V//修改显示内容
; m6 l. c% S( C: Q$ ~' Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 W5 @8 ?- {6 t: P) T# S2 H1 `/ W6 d2 O* w0 w" b* m% `
' f) `0 b3 L+ y3 f8 h9 T, B5 D
////下面不需改变////////////3 |  y+ Y! @+ _$ `, j5 x. R
( S2 v* K$ e9 c7 H; f
var copyspeed=marqueespeed
' Q( e& w% d0 n1 evar pausespeed=(pauseit==0)? copyspeed: 0# b8 p+ f& G) Z) Q
var iedom=document.all||document.getElementById+ j7 u! N  r( g& J3 m
if (iedom)8 s6 P: ?7 \9 e# V, h2 `7 X( B* ]7 a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 |# I; |0 X8 _
var actualwidth=''# c0 b1 F1 f3 Q9 C7 `7 g* L: X
var cross_marquee, ns_marquee
& y" h2 |/ t" L4 p. _# p" u
: U; d/ o" l( n. L2 G6 z: wfunction populate(){
# u1 B/ I2 _! W6 n1 o( iif (iedom){
) b; e  ]4 O: O9 l  lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 }! ^5 {: h: H
cross_marquee.style.left=marqueewidth+8, x2 |  _; |# p- ~; x4 R
cross_marquee.innerHTML=marqueecontent
2 E& g- B7 U4 t6 ]1 Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 f, ^* v: \! L, X}& x! d3 _- o2 m: J
else if (document.layers){
; _# k: D$ e2 Z9 H+ e! I) @ns_marquee=document.ns_marquee.document.ns_marquee2
( n  q5 Z2 H# u& G% k8 j* \+ Y8 Nns_marquee.left=marqueewidth+8) \3 k0 ~" ~$ C1 X+ u6 q, l/ S
ns_marquee.document.write(marqueecontent)( L' D' X: r! t3 z
ns_marquee.document.close()  e0 o7 D) a- w8 ?6 H
actualwidth=ns_marquee.document.width% m! d+ B; U$ x! K0 ]  }# N
}  o/ U6 e  e/ u: I# ^
lefttime=setInterval("scrollmarquee()",20)
8 w8 T* n/ q+ P* _# \}
9 ?: Z  g& D) n0 G  }window.onload=populate
7 o0 T% p! r, V' l1 r: Y; u2 Q: y/ Q- ?8 A/ P1 }
function scrollmarquee(){
0 G7 d3 Z" X  x1 \& s9 Sif (iedom){
5 B5 F0 i+ z- B2 S* w: [/ Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ Y- P/ X" }; J% j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ Z9 H) J4 X5 P3 a: _else
. P' K7 M. d* d) o; P! N; H6 [. c- ]cross_marquee.style.left=marqueewidth+8! t1 x) o: Z; @+ G9 K! j8 t
5 Z, \, K' c# {& I
}% J: w" I  i+ W6 ]& P. n& J
else if (document.layers){
; }# V, }6 w0 Oif (ns_marquee.left>(actualwidth*(-1)+8))
4 ?. }: v6 P. |* L; C! {ns_marquee.left-=copyspeed8 q# s" O) M5 _0 N
else9 |* V2 M6 s* Q# L+ R7 N
ns_marquee.left=marqueewidth+8
, f7 f  m/ F- Q1 v  S- H. M- a}
9 s. ?7 o# y8 ~6 S6 R, p}. u( A. m' z# u! x8 Z

! K, R. a* f' a1 t1 H2 L1 hif (iedom||document.layers){
$ L6 U+ ~% o) A% bwith (document){
5 e7 w& L( G% F3 Q  D( Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 d+ k- \; l6 P1 h3 W2 y6 K8 V
if (iedom){9 y, L2 Y9 U" Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- Z0 n& F# E' N; Q7 q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% a- \: H5 n4 q% N1 _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  r5 f- r& y% hwrite('</div>')
2 E/ o. E) B: z( Q' h}
2 a1 Y9 m' Y0 ~, @/ uelse if (document.layers){
: Q0 ?  [+ e7 C6 Q5 Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 \! w$ ~6 u0 p* j( T7 Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 Z4 F+ F1 {' p" d/ F0 \3 k% C
write('</ilayer>')
; f9 K6 D' P! {}* }$ P2 ~2 y3 L2 c3 p1 {
document.write('</td></table>'). d5 V4 G" a* X( I( A/ C0 `$ Q$ K% X# z, G
}" {5 t1 E' o% d) J4 k' |- \
}8 F& z# S' k" L
</script>

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