返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 }- N3 o/ y& Y- _6 S7 Avar marqueewidth=300
' r& N  M2 r, m1 u, w/ T# Q7 |//高度
! x5 |. K& J& V! e" E# Rvar marqueeheight=25
0 g+ Q4 Z. M  f$ R% b/ O; ^4 {//速度(1-10)5 C) g. Y& Q) H; v4 g$ y) k
var marqueespeed=3
! O9 ~: u$ y* b$ i3 L  d//背景颜色$ T. z2 U8 K# U; G
var marqueebgcolor="#FFFFFF"
5 E- T. ^# e2 h//是否能暂停 (0=no. 1=yes)?
1 ~2 V6 A5 R* j1 t" L! }% Ovar pauseit=19 R6 G5 _) x: s" Z, ?9 z2 `, Q
& T3 Q7 X3 `: n
//修改显示内容" r/ L. @/ g9 ^, X/ t% c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 a" |: r% O: i0 l1 R
7 b( n  a! K7 R1 ?1 I7 E- m& ]6 L
7 F, y5 v, J9 y$ }8 r( _  m, p( Z
////下面不需改变////////////* D# h/ V3 Q; K, ?  s6 M- L9 e' x

0 ?( r( p7 S/ p8 V. E4 Zvar copyspeed=marqueespeed
' ~* f( H; c0 P& Rvar pausespeed=(pauseit==0)? copyspeed: 0
8 ~4 H( c0 @' @4 Dvar iedom=document.all||document.getElementById( L2 M( L6 Z* m  c4 `
if (iedom)
& g/ O5 F% w2 c: O5 ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), U! q) i4 \% G/ C2 ?' \% G( J
var actualwidth=''5 N6 r- p! p# F
var cross_marquee, ns_marquee
; F/ t  A. \& m1 C8 O6 H1 R$ ~& C9 f4 [% @0 E4 f# G& Z
function populate(){- |& L( h& p  U* O/ y
if (iedom){
' h9 D. x5 m% M3 Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  N, C/ r  o7 e
cross_marquee.style.left=marqueewidth+8
7 M  Y0 A' K. E- S) \, T* Bcross_marquee.innerHTML=marqueecontent+ i8 R. h. B8 |) x
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' B4 ^" G" }+ L' y" @
}
( c; g0 {, P$ [4 Celse if (document.layers){
& E$ A6 n( U# U- A3 ]& Hns_marquee=document.ns_marquee.document.ns_marquee2
/ B5 D5 L+ r6 _. b1 `) {3 xns_marquee.left=marqueewidth+82 X7 k  h* w) n1 g- M
ns_marquee.document.write(marqueecontent)
/ E+ n# Z- [% V* Sns_marquee.document.close()0 t: ~* {3 y) a6 ~  [% A" ^
actualwidth=ns_marquee.document.width7 l2 G* ]8 O1 T
}: d; Y, l3 r- W9 H( {  A! O
lefttime=setInterval("scrollmarquee()",20)( N7 R& q( Q: }& p/ |
}
1 C5 `$ ^" V7 W5 [window.onload=populate* T& O1 s/ D2 ?+ Z9 q2 b" L
2 w" c' I# m. G$ ]( W; h
function scrollmarquee(){
" o2 H- I- f  {: C9 J1 Xif (iedom){+ H! k) W6 w. x% V* d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 K% p' C2 Z6 o& V& c( lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 I  k: i% r6 s5 `6 ^. l: a- y
else( |0 ], [- E+ X) M6 K
cross_marquee.style.left=marqueewidth+8
2 T: i- S8 ~) c* L
+ v+ x& I+ L7 a}' K% b  P! e: }3 ^; g
else if (document.layers){8 i5 r- V# a( j4 M
if (ns_marquee.left>(actualwidth*(-1)+8))
9 [; O" v9 O3 O; Sns_marquee.left-=copyspeed4 o. t7 l- `! D7 y6 j
else0 R( _- t$ i5 L% B
ns_marquee.left=marqueewidth+8
/ s, A7 V' A+ R9 o& O}0 m/ y5 W$ n9 c" t1 |- D& x. f7 V
}$ `6 t7 B' Q! @

- k' C9 X8 k& W* `3 W- lif (iedom||document.layers){* ?6 h3 @6 a. E. B
with (document){, o% _. T- s  a7 Q3 Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% t3 n% q& P; _! x- N4 o, [: {4 m" Aif (iedom){, u' k5 F' P* }# `: V3 d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 h! W; f& H1 _* ]- M3 X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 k" C- P7 Y. C# G% H& H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 q" Q# I! o0 h  [+ Owrite('</div>')
" Z1 J5 G6 O2 f$ u}
* Z- _+ G* b; u, jelse if (document.layers){
/ W) v" C; Q: u5 _$ z4 xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 B0 ]6 j8 ?7 Y: f. Y7 i' K* awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 g2 m+ b3 _$ D7 ~write('</ilayer>'): D# D8 q2 S2 s2 p3 U
}/ U( S1 K  q9 a9 k/ h8 r3 w
document.write('</td></table>')
8 A' R. G" B' C9 Z9 o" }" `5 i9 y}' m7 q+ c' Y; R5 S6 i4 N
}0 ?8 U4 G3 M& E- a" i* a5 Y# `
</script>

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