返回列表 发帖

网页之跑马灯文字特效

//修改宽度
  I% s7 m8 E2 V$ H2 S2 Yvar marqueewidth=300/ Y6 v, e2 [5 ?- C: z; G& _
//高度5 j' W- d) [; I8 q$ H# \9 {
var marqueeheight=25! _' r/ R( _! ~
//速度(1-10)
9 I3 X8 B0 P; t$ r0 Gvar marqueespeed=3
, g+ q. l) |, v' d; ?; d//背景颜色0 N! ~# f& Y5 ?7 z+ h
var marqueebgcolor="#FFFFFF"
+ j' d6 A, Y: N8 k  H7 x//是否能暂停 (0=no. 1=yes)?
5 U: J% y- P# ?) v: Mvar pauseit=1
" J6 P( K2 ]9 n. D; i/ Q1 V8 R
3 I9 R2 @3 q5 Y//修改显示内容8 M. r1 E0 _, ~3 y) j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 {$ s3 U( g" t4 e5 {" a  x' i

) d" Z7 T- s2 \6 z% J) S5 I! z1 r. o0 ?0 a! L0 U, B
////下面不需改变////////////6 q; W; D' K; e1 C' s5 o# g

) u: m0 G( v& X2 xvar copyspeed=marqueespeed2 d/ ]/ y4 I+ Z: r% u
var pausespeed=(pauseit==0)? copyspeed: 0
) M/ E' |3 a0 g* A1 h( gvar iedom=document.all||document.getElementById
( Q1 A) k) C) J( _if (iedom)
" B0 i6 \# m9 @8 W1 Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 X4 M- v, A" N. m1 u4 e
var actualwidth=''1 w6 j4 c4 i$ W, e" c
var cross_marquee, ns_marquee
+ B- C: Y- q* w- l. _& _1 J0 X) J$ @" p! o# A
function populate(){
0 j5 U( @% B, d3 B- C& Z9 U! v  Bif (iedom){& O3 J- u: F1 k( l# s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 R4 }  N! f& H0 V- h$ c' @) r
cross_marquee.style.left=marqueewidth+8
9 [0 R/ m0 c, l8 r. jcross_marquee.innerHTML=marqueecontent3 m; @5 N% C; T1 @, l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' m: X) `+ ?% ]4 Y, F; D# {. h}
7 H" A! `! a0 }. r, B4 G9 ]9 Felse if (document.layers){
) Q* J  c0 s4 e$ i3 A, {ns_marquee=document.ns_marquee.document.ns_marquee2
! Z( `5 @( @* ^ns_marquee.left=marqueewidth+8( m7 f* A& s5 [! N0 }  ^+ i
ns_marquee.document.write(marqueecontent)
  R/ I0 X! ]$ o) G; U" ^# Nns_marquee.document.close()- l# g: |2 i  y: W1 q% Q+ f
actualwidth=ns_marquee.document.width
8 p: u7 j6 U0 U: E( p5 u3 ^}/ H' N4 g7 r% e9 a& x
lefttime=setInterval("scrollmarquee()",20)+ N: ?0 D0 a. ~
}
( W# F! j& r, t8 f9 i* Cwindow.onload=populate
  @: B1 _$ W5 a/ u4 j0 b) H
8 `5 ]) |. b, g& q2 h4 S; m+ hfunction scrollmarquee(){
) w" g0 w5 h* C5 v3 J/ ], tif (iedom){1 L# u2 [9 k# `, w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ Q. v9 G- A+ `( ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: \) M7 |* M& V% p
else) i3 b* o' p/ E# Q
cross_marquee.style.left=marqueewidth+8
( c- ^; ]# b, e0 c# ~+ V! S8 v4 g0 X) l# F  ^9 u; a: M
}3 k  C( b* A) P, t
else if (document.layers){
" b: k8 U5 s, \; }6 L% D+ _if (ns_marquee.left>(actualwidth*(-1)+8))
) @+ {4 ~$ X9 ]! F* Uns_marquee.left-=copyspeed4 B6 S6 g" G- C7 @) P0 `2 U; Z  G
else
2 c# q" z+ c! F- C* R! A. jns_marquee.left=marqueewidth+8% b* H7 b7 ^% K* K$ w. a
}
& E/ B3 Z) D4 X( l2 G}- ?$ ?5 s- S: ~; P* L2 y. ~

$ @2 T& d" G3 ^$ J$ Yif (iedom||document.layers){: x/ \% @/ y% Y* l
with (document){3 a, G$ a7 S4 t& V/ @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ |$ R. b" x6 D: hif (iedom){4 _7 B5 O6 r( Y7 [. h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" G* \8 l4 h9 ?: ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ _& h# R5 Z$ B+ K5 k9 m1 ~% s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) F1 X. `$ q& O2 lwrite('</div>')1 ~+ o( R( {  d6 B, s/ g
}/ {+ p+ I$ `, B
else if (document.layers){
, _" x4 q' F8 o0 H* [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 C% j$ F" g$ U: g( g4 Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 t& i: ]) n1 A2 X, Qwrite('</ilayer>')  m# ^3 o  P9 B4 b# e1 ~: A
}! g0 h) ^" B: h/ m; _0 q8 n  ]
document.write('</td></table>'); L. B$ L3 v+ }! c$ s
}+ Q# s) b6 F* S! I* H( c1 p3 |" A
}
7 {8 M) w2 {( O) i/ ^2 C% ?</script>

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