|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
+ k1 j' k( e4 Q; ?5 B% \var marqueewidth=300
# V! E: r: u, ]- X( k//高度
8 M7 D% J( m; G5 Rvar marqueeheight=25
) ?- v; H; P# c" W7 T/ A) z" D q//速度(1-10)
$ |" @" K A2 vvar marqueespeed=37 O* o8 s- y9 x: F/ E% A
//背景颜色( b9 x; P* [" B. i
var marqueebgcolor="#FFFFFF"# q. |. Y0 p6 C+ |
//是否能暂停 (0=no. 1=yes)?2 E8 y: @/ P# G6 L+ `& G
var pauseit=1
' E9 l" @ c8 C( v# h
" X, ^% ?3 B$ C4 c1 ?% n& b, L//修改显示内容% T6 p1 {" i9 X2 [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
T4 H# U( y# M& J; w+ ^3 h6 @$ W# H, Z
3 k& U d9 K: G; X$ y
////下面不需改变////////////
- W/ G+ i0 H: z; {/ o# W9 R" I! h, @4 h! B! {* }2 C) u
var copyspeed=marqueespeed
2 O, j& I! n3 c- Qvar pausespeed=(pauseit==0)? copyspeed: 0
0 v2 O8 u% c. i* Fvar iedom=document.all||document.getElementById
) O2 s/ e* G0 J+ {% t* F# z4 Pif (iedom)( I, i6 a2 b6 \9 T% @
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" A( h0 l5 i( ?. M4 evar actualwidth=''
: `+ b- P4 L# Zvar cross_marquee, ns_marquee. l' [! U- u( X5 O2 k
, w" q$ ?( F5 p& P# c
function populate(){0 G9 U5 I1 Z4 D, q, T5 }" P
if (iedom){4 ?0 R% q3 L! k% C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 Q' T$ e3 T* a& ucross_marquee.style.left=marqueewidth+8+ P; D' T$ ?6 Q; h0 D8 H8 w
cross_marquee.innerHTML=marqueecontent
1 o2 w6 x3 `/ p9 \8 b" ?' o7 Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: J0 ^' U6 a7 v# x
}8 _+ ^" [% g- w3 y* G
else if (document.layers){6 x" r+ _/ t, b# [
ns_marquee=document.ns_marquee.document.ns_marquee2. @9 T% Y" R& f
ns_marquee.left=marqueewidth+8- E5 Z" x; g r% h$ X) m3 ~
ns_marquee.document.write(marqueecontent): {$ ?, X+ [1 X
ns_marquee.document.close()
7 v4 e- G1 S4 J t1 E% ` v5 s! kactualwidth=ns_marquee.document.width- | u7 h6 m2 O3 q
}
5 d# A, Z# D/ I5 A6 Plefttime=setInterval("scrollmarquee()",20)
, Y/ @, k9 t3 ^1 ~}
- |. m, {$ a0 R+ a$ jwindow.onload=populate) Q, f9 S( m/ u* y5 e/ n
3 ]8 h& @# x& D6 |4 Q
function scrollmarquee(){
, b/ x: d/ L' H( `$ I$ l% B5 dif (iedom){
9 ~& l+ @, M7 Q' M9 gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ x, H/ S& O q% o) Qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& w: Q1 ~6 Z# u3 \$ R$ ^& Velse
0 e0 B2 J( o- _5 Lcross_marquee.style.left=marqueewidth+8% N- Y2 ] a6 S; f2 M4 n
q' ^; W5 P% I" ]}& K+ H% M- ~( j8 @# U D7 | ]
else if (document.layers){+ L6 y+ J) X0 G" K
if (ns_marquee.left>(actualwidth*(-1)+8))
1 l2 ]8 v0 f/ w* `ns_marquee.left-=copyspeed
2 q, s; o, `3 [4 ~3 I5 w* relse
$ R( M2 b/ M/ `5 n- x2 zns_marquee.left=marqueewidth+8$ D2 z2 p' U! V5 G* Y" O
}/ i {- X8 T; f( w/ t
} B) K6 [8 q$ j4 e! c
' H" u# z& i, l9 k# jif (iedom||document.layers){* i4 |% x7 T6 B5 V: H+ F: n& P
with (document){2 t, x5 |# a3 x% I$ J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ @3 y* y2 J$ O7 u( |
if (iedom){- Q, x' c: J! B- b d: w
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
W3 v5 a9 }" \1 n8 o8 C6 U2 g% ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# b) r/ {* c, P1 u7 J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( w# @" q) G' [
write('</div>'): ?3 ^, r5 F$ W, D/ u9 K/ }6 V
}
! |$ _& _# T+ [else if (document.layers){% G1 ?3 |2 r1 H. z2 b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, N0 K) x+ w1 f5 zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), v x+ t) ?/ Z9 Q( Q: ^ c5 K" }# o
write('</ilayer>')6 \/ e8 ^' l: W) ?8 P, c& Q, c
}7 x* x. N a6 j+ }8 z
document.write('</td></table>')
J6 t( r7 ^) E! X3 b; K3 [}
& K {5 p/ U" e, G5 r}/ @1 K3 R; k8 P6 a5 R
</script> |
|