返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ c# ?- o& d3 }) d
var marqueewidth=300
, Y8 i  w1 S+ e1 @* j+ M- H) |$ Q//高度4 ]' }, q+ z# c
var marqueeheight=25
, ^6 j% `$ x3 O' f( i* Z' |9 G//速度(1-10)
9 H2 h  z+ p* L2 ^* svar marqueespeed=3
8 y6 r. w- Z. i3 B2 A% T//背景颜色
, D4 R" b! I" Z. X) D. g, X; fvar marqueebgcolor="#FFFFFF"
& \/ c9 M1 R+ k7 k//是否能暂停 (0=no. 1=yes)?
" _1 b& K( b/ n8 @4 T3 rvar pauseit=10 B5 t! r/ M; {+ m; v; S7 g5 ]

" }3 O3 Q7 r2 V$ |0 @, B//修改显示内容5 r: @8 R0 Q: c; E. R6 C6 M1 l+ T
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% S( L( f/ `1 k0 e! C/ ]/ _; f& I" f" r1 X2 v5 ?7 b' l
$ n6 D5 z6 i8 h! |: C) q7 {
////下面不需改变///////////// r8 r$ N# S  Q9 i6 b9 F4 `

) r: Q  y  D+ g  V* N; wvar copyspeed=marqueespeed% j# B4 W# t# v6 H; p( F
var pausespeed=(pauseit==0)? copyspeed: 0( a& c' ~! [; M: w; \
var iedom=document.all||document.getElementById
/ |$ O; O2 l2 p, O$ x" b3 t" Jif (iedom)8 N; ]% n: _' h2 b1 L8 k" D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): L6 y5 w8 s# C1 m/ s! j
var actualwidth=''
9 p3 @! c( `2 X) l( W2 \8 Yvar cross_marquee, ns_marquee
) @0 A8 T  n/ }) `& ^& v. X/ d# L" Q' k6 [/ X+ N: X
function populate(){( K3 o3 Y. @' M* R$ `
if (iedom){# g6 X, [+ D5 b1 i" n, V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ m, i: v$ I" J
cross_marquee.style.left=marqueewidth+8
! K0 d. a, p/ c. F! Across_marquee.innerHTML=marqueecontent
3 f5 C, A' Y7 @) u- T  \1 ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# ?! W$ U" m9 B, d/ ^, E( _}7 Y, s3 ]+ L; }$ o) R3 d
else if (document.layers){
, k5 Y# \5 Y8 Uns_marquee=document.ns_marquee.document.ns_marquee26 ^9 L* Z" e; Z$ J4 a+ V
ns_marquee.left=marqueewidth+8
" I$ o0 v# ?$ j- O: rns_marquee.document.write(marqueecontent)% N, f7 ?, }3 h
ns_marquee.document.close()7 t9 @+ X# t$ x
actualwidth=ns_marquee.document.width
# }; ?( E5 \( z7 h! F4 H6 ^}3 [$ i3 m! e% u
lefttime=setInterval("scrollmarquee()",20)
0 T: N8 p# l' ]9 k8 }3 L}
# s8 s/ Q3 A% Hwindow.onload=populate; h7 H; a" ^: ~& `- x5 X* F* x6 t

0 V, c: t: p! |5 ?& y2 Ffunction scrollmarquee(){: a  v( K1 s8 P0 ]1 I4 }( C+ x
if (iedom){" L+ a  A; `& o3 M
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  M6 z$ B; ?! ?& I# R8 L. Qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 _5 ?6 A* }& f2 q- B) D& p
else9 U! Q" J9 z' y  e
cross_marquee.style.left=marqueewidth+8! X+ U6 c: n; h. P3 R. e
% r$ a- R5 O2 Z: V" M& E
}5 E: Z; A9 m! u: [& }0 S
else if (document.layers){5 E/ f' Z/ d: A2 P. }
if (ns_marquee.left>(actualwidth*(-1)+8))2 X- T" d6 S% T# K# j/ E8 Q
ns_marquee.left-=copyspeed( H4 h/ ]* b1 o' }8 O# B" [% n9 D
else
2 i! c0 h& q, }) M1 T6 e, {% {9 Xns_marquee.left=marqueewidth+8
2 F# J5 A0 |: _}
0 r! L7 C! ?% B9 i}
0 t0 _5 T0 d0 R
+ v" _3 {0 T' O! Gif (iedom||document.layers){* R: ]9 F( o- S6 F' ~9 U
with (document){# J) x! G; P# e5 y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 E9 S  f1 w' ^, Y9 Q0 Gif (iedom){
1 O0 |  f- p/ L' A+ o) Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 H- J' @2 S( ~+ }
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 q6 [# ]" v3 z6 C' g, B" F. h
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 `7 B0 `  ~7 k9 h: E0 V& _9 |
write('</div>')
0 N9 ]9 G: N3 n* g}
0 [9 F2 m9 a8 B! W- a. |5 a$ e8 Jelse if (document.layers){1 P; g) G1 W3 Z2 N# z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 e' U  z1 R- s7 ?7 e
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ ^7 d" u) T- u, E: Z  T( t" ewrite('</ilayer>')
, Q7 }6 q" S$ x2 p3 A, [: f7 [3 {- W) j}
' a  J" ]* J. a$ Kdocument.write('</td></table>')! [& L4 [0 s  Q! U0 A; l' v! Z
}$ t/ p% \" P2 P7 L9 E( A2 x
}
4 P! d, _* I) z0 P2 t</script>

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