返回列表 发帖

网页之跑马灯文字特效

//修改宽度* g& G6 k8 x0 \2 q7 c1 z
var marqueewidth=300
2 p3 q. }# ^* r; |% t; N' N- d8 g: H//高度
2 F, \# m; T' Kvar marqueeheight=253 i4 ^, ]  d, y0 a' A* Y
//速度(1-10)
& A/ r3 l( M! Xvar marqueespeed=3
. O6 \) \3 p: r4 [4 T# j//背景颜色3 r9 Q, n, J) h" ]9 C6 _$ f
var marqueebgcolor="#FFFFFF"
! ^9 W' H' x8 }1 ~//是否能暂停 (0=no. 1=yes)?; _0 w% O; ?& K6 j- k, H8 S- z
var pauseit=1
/ g4 f* j: k( h, ], U  v9 y, T0 c* b* p2 J% s+ A7 e! V3 S
//修改显示内容
# E7 d, V8 S! [9 k2 yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# \6 g1 }4 |4 G7 H4 h  H! Z
! z6 d9 Z3 D/ C, H9 \; J
, ~1 ]: e, r6 `" e' ?$ I& s' V7 o////下面不需改变////////////
$ z  U7 v+ h% z3 u3 R! i' \% X
var copyspeed=marqueespeed
& R/ i& B2 r8 K, }/ a& ]' Wvar pausespeed=(pauseit==0)? copyspeed: 0
/ E3 Q' j# ^! _6 r0 i# S/ R6 b! avar iedom=document.all||document.getElementById: s* k/ K# R$ |. g' |6 p' ~
if (iedom)
6 R' n* i. Z, T3 p: Q' }' Sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' d2 s. U( e: pvar actualwidth=''; n4 b5 g% z- v7 d
var cross_marquee, ns_marquee2 @/ p2 r* [' {9 \; ]5 u

8 ^3 x* p/ W6 J7 @5 G: Dfunction populate(){/ ]: M. m. o7 X5 `$ b- b! a
if (iedom){; Y4 F7 A! g) h3 a! L4 {$ |
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 |: b2 G0 o; G: G  ~
cross_marquee.style.left=marqueewidth+8
7 b5 p" o# |! X+ ^( x1 N* X1 vcross_marquee.innerHTML=marqueecontent: u$ E3 N3 J' j1 O9 u: ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 n* D7 r0 o  p2 i7 j4 M& d( g}
8 z! Z5 R8 m; |3 Uelse if (document.layers){
# T( f* g0 s2 `+ Wns_marquee=document.ns_marquee.document.ns_marquee2" c& ~; Q% ?1 {
ns_marquee.left=marqueewidth+8
! _1 k& H8 |& V6 V$ _6 u  M: Dns_marquee.document.write(marqueecontent)8 j! W( N: c: w6 \) X$ e) m
ns_marquee.document.close()
- o" i. E9 A' A/ G$ B2 m6 Yactualwidth=ns_marquee.document.width" F" s2 G8 O( @1 O! r
}: s+ r% s7 c& g/ C  M3 _
lefttime=setInterval("scrollmarquee()",20)
0 ]  s1 }9 A% ]/ i}) l/ U( Y5 P( I( v2 Y" f5 {" s
window.onload=populate" w2 J: H& i. M' C( R6 n* @8 C
9 l0 h& ]0 L* [! o6 Y7 _( _+ i& f$ M
function scrollmarquee(){
( ~6 F9 U( P& q: [if (iedom){
& u4 E/ Q( h( g. J- I' W8 Z/ [8 R! jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): A7 R! P8 h7 K5 H9 u1 i7 \' p! ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 Q8 M# ~0 u, E" \4 ]* X
else
8 V& C: G- n, y) ?! Rcross_marquee.style.left=marqueewidth+8
+ x! _2 ?# N: ^: S" p4 ?& k3 Z% u2 J
}: q+ J, a% U# E& K7 `- n" V
else if (document.layers){9 [! g6 B- _' \  @4 Z
if (ns_marquee.left>(actualwidth*(-1)+8))" b3 A& z" w* ], l
ns_marquee.left-=copyspeed1 b) N! A# r" J" N
else
3 f' Q: R1 }+ Ons_marquee.left=marqueewidth+8! l3 P. ^7 u: m  o6 O5 W5 ?
}  H1 i% _$ m/ w5 q% G1 R
}
6 ~, b, B. X7 ^/ T+ z+ [
  i0 {, d  i# q# O9 n. w5 @! o  @! aif (iedom||document.layers){$ k# l6 X1 C* M( k, q0 D0 Z
with (document){, u* T2 \2 z: t" u6 ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' v* H3 k& ]0 g$ J( Z
if (iedom){; B) |1 |# k% m6 s" ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! Q6 V7 p9 R& n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 B* E( H0 c" O% p; `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 T" b' D6 @! e& E; v. Z
write('</div>')
2 e+ Q) G- J2 p9 j% F" y" u}
5 z' G/ r) }' ^& r: T5 j$ selse if (document.layers){6 h8 a3 \$ s1 X$ a# ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). g5 B; m2 s' W/ |+ ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* z5 B  v( M* P& _$ |" l8 a/ m' g
write('</ilayer>')4 @" X% \- c0 V9 {* Z( U: L! `
}
) \$ x; N# U1 l( S8 fdocument.write('</td></table>')
5 p2 N$ i9 O* `! o" ~}+ z5 Y' C* R1 @9 f% x+ ?
}
3 G+ A& r" P" v' J9 h+ q  g</script>

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