返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 z4 n  B1 l$ T6 vvar marqueewidth=3007 J; K/ ]6 {$ P8 ]* ^
//高度
+ Y1 k! Q4 @4 p- z" r1 hvar marqueeheight=25
8 T. R: @8 W- g# L& l//速度(1-10)
  F$ @, }6 n: T0 L; \: fvar marqueespeed=30 Q) }( V0 l( ]
//背景颜色( t# H& O7 _/ Z' P0 j
var marqueebgcolor="#FFFFFF"# ]. d5 _9 s: V7 s3 _- L8 ]/ n* l
//是否能暂停 (0=no. 1=yes)?4 S( U; U( o. C: X, c
var pauseit=1; G" K4 P; _1 L( o, f5 |4 _

8 D' D7 W' l, @3 P( t//修改显示内容
) L1 w# S( z+ c' Q8 \var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! e% B3 ~& a! E" s7 j

. k5 I3 v  ~& F* u- r7 P2 i1 |- P3 |/ b
////下面不需改变////////////, Z, L$ y8 @4 B3 {$ S" B" s
- Y+ z( j+ b+ _* l
var copyspeed=marqueespeed
. b* K* B. V6 V& |. Q% tvar pausespeed=(pauseit==0)? copyspeed: 05 {" v. }9 d% g$ D& T9 a7 P
var iedom=document.all||document.getElementById0 w' |3 j0 |$ S
if (iedom)
9 ?( J; H6 {$ K8 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ V+ ?( w! b$ _. M5 {+ g# G! v6 z" yvar actualwidth=''! L# C( I& M: U
var cross_marquee, ns_marquee! i1 C" H9 o8 d0 v

6 A8 M% J3 T0 t! H/ j% zfunction populate(){
6 m* m+ b- R% S( Q  uif (iedom){; X8 t& j* s' i$ G7 X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. _5 ~7 ]9 p  w5 q' `! ?0 E1 rcross_marquee.style.left=marqueewidth+8
8 z8 q5 V# u4 a5 Q! scross_marquee.innerHTML=marqueecontent
8 x! h$ ?5 T1 N- ^' z; Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 k' [. c% C7 v2 |. V
}, ~" K" J+ o1 h& R9 ?6 v
else if (document.layers){4 O6 k- Y% Y8 l) o4 ^4 }% O# Z
ns_marquee=document.ns_marquee.document.ns_marquee2, [7 o/ s. z/ C' d
ns_marquee.left=marqueewidth+8) ]0 ]" q; W+ @9 T
ns_marquee.document.write(marqueecontent)
2 i+ I; w  A; x# L( Q: |* E" ~ns_marquee.document.close()
. f& [& t* b7 f! c) Eactualwidth=ns_marquee.document.width# S( ^+ n# D; l; K
}& F# j% @6 E7 [( {  m( C, M# N2 ]
lefttime=setInterval("scrollmarquee()",20)) R- q3 z& Y4 n3 z5 [! F# z0 {
}1 W- @7 z' C6 d3 d- ?! h, L2 o
window.onload=populate
& h4 S& |; P  L4 b# H! \
% y' b! O- {# r1 ]4 Y% G3 Vfunction scrollmarquee(){  v8 T* p" h; m7 G% @, r
if (iedom){" Y: a# S8 \7 \  h
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 l! Y6 V# W( d8 ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' u# k' t8 d+ E. x) _, K$ A# selse  Y: W2 ?# _) C2 p0 z8 M/ s1 ^1 {
cross_marquee.style.left=marqueewidth+8
7 L+ {: Q, v; y; O( |3 z" D& r) w0 b9 j* X  @; k2 r7 U+ S
}
' x' Y4 I* S# M8 qelse if (document.layers){! M; J2 ?8 j" X( \
if (ns_marquee.left>(actualwidth*(-1)+8))$ o6 e7 G) w! H, a2 r8 }. f8 A# j
ns_marquee.left-=copyspeed7 N+ h& m$ U% U$ r6 ^
else: V' |& o5 Z3 I4 m4 w
ns_marquee.left=marqueewidth+8
8 E6 U' D/ j+ h" M- b- ?}
4 z" G! M& o8 S& i* Z  ?}! ^0 Z1 C- ]! J4 e
/ ]' _3 i# b7 [4 s; I3 e3 ]
if (iedom||document.layers){
1 U! @4 k; N' b0 I+ J% E; I0 Pwith (document){( t  F4 v: K5 z# |5 o  I( _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ Q& y0 V7 s8 u+ Aif (iedom){0 `5 i7 ~& |5 y& g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 r2 m5 N% D$ e) I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" ]& G$ y% g6 w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% U0 g3 E) _, u! ]write('</div>')
9 h" J8 h! e0 ]}% _. u1 V( o# }8 W
else if (document.layers){3 [( {, o9 X5 u5 Z7 o' J5 R" k- W& ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ @0 X5 K+ M) V( a3 \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 a3 E* \' @) ?2 a  t
write('</ilayer>'). h! P1 ^( ]. h
}* M$ K* g7 ^& E- D
document.write('</td></table>')8 m  ?" A) Q6 E; q) O
}! Q: b+ P. I! z4 N, H' k/ l9 `$ q
}
5 W* o4 t) x, C0 ^</script>

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