返回列表 发帖

网页之跑马灯文字特效

//修改宽度, b$ I. r1 x! G  G5 P8 J
var marqueewidth=3006 C' I9 v* L5 r
//高度: Q6 q8 g& T$ f; q, h5 w( Q
var marqueeheight=25
* q& c( o8 Z1 [7 U+ i  @& u( i! h//速度(1-10)
3 j- D" G& z- G* b9 l  _& R% nvar marqueespeed=3- N! a! z+ S5 K! n6 d
//背景颜色; }7 R. V, o& b  J' x+ R
var marqueebgcolor="#FFFFFF"1 f1 |' n6 B9 {7 @% u: Q4 v2 {
//是否能暂停 (0=no. 1=yes)?
' ^+ Z1 a+ u+ Ovar pauseit=12 q5 d( m/ }" t; x1 k( r: r% t

2 [3 K. K5 r' S5 {7 F( N//修改显示内容
& t" E( s6 R# z* xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% v( \) Q4 j5 W, b( e, ^7 n5 B. Z9 p0 F6 X3 D8 w, g2 S; G9 t# }. h
+ U! T8 i' y2 l( N2 D; l
////下面不需改变////////////
6 ~$ k; I3 R1 N6 q6 y2 t4 T- B& k3 |/ O8 H, _! y
var copyspeed=marqueespeed
7 U% [' O# j" dvar pausespeed=(pauseit==0)? copyspeed: 0" P" \6 h3 y  g( P/ C. I! {
var iedom=document.all||document.getElementById
3 o6 e+ O# t$ O. A% gif (iedom)" y- U( Z( c& W# u3 v3 ]
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! Y. c0 h/ Z9 J, W+ \8 xvar actualwidth=''
; d. P( p" q+ X9 L! f( zvar cross_marquee, ns_marquee
. j5 _3 }* U+ c  h4 E) S- q8 a
2 |" U$ z( q- b" E6 n# yfunction populate(){% u3 Y  F, X9 ~5 w4 n- {
if (iedom){
; H8 Q* K( K( o- G# Kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* j% W/ a, ?  {4 S+ w! q6 Pcross_marquee.style.left=marqueewidth+8
1 d% k5 d& I4 |" \cross_marquee.innerHTML=marqueecontent- y7 ?6 r- l) b2 q; B. s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- L( e' @6 w( C}
0 Y5 d. |/ _) f* D5 O7 ~, B; p8 Oelse if (document.layers){+ N& ~. ?/ ^5 ^# w
ns_marquee=document.ns_marquee.document.ns_marquee2
$ b' a/ S5 G- Dns_marquee.left=marqueewidth+8  E- R' i5 {% u. O/ r
ns_marquee.document.write(marqueecontent)/ `7 o* _5 [" P: N# X+ V' z; m
ns_marquee.document.close()* R3 H4 v- h/ x/ [
actualwidth=ns_marquee.document.width
6 G& G3 w* ]( n  j}
0 s  w) r% W+ e: s( h3 f6 `lefttime=setInterval("scrollmarquee()",20)& ^+ l8 F% q. t* U# w0 t
}
; m6 t1 k( a$ \) \9 k6 W8 U% w$ _window.onload=populate
/ O, Y! e1 R* H) h& e& N- J6 _$ q0 E, l9 L- V7 E# k- r; E
function scrollmarquee(){8 w. w7 y0 O$ x: P4 ^
if (iedom){1 h0 K2 Q) J9 f7 \$ |5 G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 B% Y! H; ]. {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# \$ i+ Y) q) T8 d$ {else" I! S" ?8 R0 _: h
cross_marquee.style.left=marqueewidth+8
- q$ k6 J6 ^' m& R5 l- ]2 G4 J
' K( c$ b$ J. L5 p}
- f7 i% g  s( m2 _% P$ Y9 N# lelse if (document.layers){
: O, \- X/ L  W0 e( O/ j3 dif (ns_marquee.left>(actualwidth*(-1)+8))+ m% }1 l4 S2 R/ h
ns_marquee.left-=copyspeed$ O( v9 S2 y8 O+ V% [
else
& ]7 H6 c0 L" Z+ M& W: ?ns_marquee.left=marqueewidth+81 _5 d0 b* ?- `8 `
}
- z& ^0 q/ S$ h8 s/ @- ^7 s}
5 [5 b" W, V" |8 t( e/ z9 V7 M+ q3 W; B1 V5 S: I$ }2 e
if (iedom||document.layers){
; i' ?1 H" _( H" G1 q9 _with (document){, d; S: E0 v7 j4 @9 f, v" R7 S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" H( C0 g: ]6 }  l- i4 B) Z* k
if (iedom){5 z+ i( ?; d0 s7 l3 C, J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 J/ U8 ~3 A0 U4 c' I+ Pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* d& c9 [: o8 y- @+ w3 B! M
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! ^$ b# }$ l4 \" D7 |1 N
write('</div>')# t6 I  B3 }' u) N  d/ `9 ?# t7 E
}, ?; l& M6 E5 m- U6 v2 r, p
else if (document.layers){
: g6 p9 `3 w; [% V9 z4 Y, Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- l% j8 I" c6 Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, l. O( p% n/ ^$ e( O8 cwrite('</ilayer>')
' g% z! \9 i6 Y* d}
9 v) E9 _4 ~7 X  S( B7 A! o4 |document.write('</td></table>')
9 N" B8 J3 B: Q$ c/ m" q# \}/ I9 G  c9 M  g' o1 J. V3 k- m
}
2 u8 O' m5 X* @</script>

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