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

|
网页之跑马灯文字特效
//修改宽度, r2 a! b! N8 E+ W
var marqueewidth=300
" O) [/ h: X0 B: B9 c//高度2 W$ m4 F( i u( e9 p
var marqueeheight=25- Z2 H8 a1 k" \# X
//速度(1-10)+ |+ I* }# f# q* a1 G; @: L
var marqueespeed=38 i B! X4 [, p* \+ k: h3 T" {" p
//背景颜色* I* O. V6 I" n6 v; i- d+ {' C5 ^% q
var marqueebgcolor="#FFFFFF"2 q" ]+ `% Z1 {% s8 U! N; M$ ^; U, t
//是否能暂停 (0=no. 1=yes)?+ D, k0 q9 `5 s$ o6 J- U7 r
var pauseit=1( ~( [, l' @0 o8 k, t8 P
2 B5 L9 g( k; o* T7 }
//修改显示内容; _! s W3 ]9 F2 Y& Z5 x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 C( G' t0 U, R5 z! }. }
, O* S0 ?; Q3 f- p* e& Q' l" W& b& p
7 l$ G- ^8 |: l' F% T E
////下面不需改变////////////1 K- Y' q0 n, Q* k
1 i' `* k/ i! B" K$ Kvar copyspeed=marqueespeed( C4 v8 z# t5 X. I+ R6 q7 X. E/ W
var pausespeed=(pauseit==0)? copyspeed: 03 N! O& E* l8 Q" ` i6 n: h5 u
var iedom=document.all||document.getElementById
' L2 q& q/ v% R' Wif (iedom)
7 D8 Q: Q# K' E$ X7 Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' h3 J; `- X8 H7 ~8 O$ J1 Gvar actualwidth=''
! C$ \1 t7 r' y) I4 V2 Tvar cross_marquee, ns_marquee
$ ^( l$ b) X- \' P. ~8 N& l5 X) Q# a
?6 x) ~9 N2 ^function populate(){
7 y S# Y- p' Fif (iedom){+ E0 i3 g7 j9 g, O5 _) T! D( @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. n5 W0 g) }8 i; o# B9 g$ H1 x% }8 g
cross_marquee.style.left=marqueewidth+8/ f$ c& H. J5 z; o% n$ B9 M
cross_marquee.innerHTML=marqueecontent8 n6 u& G0 J! q- O+ y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" \, }# M$ Q' n+ G, M7 R
}5 o0 e2 _" @+ W/ Q: V2 _
else if (document.layers){( Y8 }) W- k% p4 L9 I9 \
ns_marquee=document.ns_marquee.document.ns_marquee23 P2 Y" w5 A0 o2 O
ns_marquee.left=marqueewidth+8
) @1 L* p. i/ T: ens_marquee.document.write(marqueecontent)
0 r; L7 w8 O7 w$ s i+ ens_marquee.document.close()
# ^% x. D. Z$ [8 jactualwidth=ns_marquee.document.width/ u8 E2 k" a8 F3 m! r
}& c: y N7 {& M7 l
lefttime=setInterval("scrollmarquee()",20)
' n- _2 B! t0 a1 z- j}
% V- k% z* X, I. M. Awindow.onload=populate
# R- U8 P6 x9 {5 y" ~, z, J+ w, W/ C5 i# w" Z& t4 [1 q+ |, S
function scrollmarquee(){ R5 H- f7 G2 ~! E3 a" Y6 b0 e: c
if (iedom){
( p8 b) B; U; Z' Z7 t, ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). a4 C+ b% x& N: T7 l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; C1 p M# X3 ? j- K# p T/ t
else* k: A: ?; E& {, M' c1 j8 f
cross_marquee.style.left=marqueewidth+88 Y+ Q6 |2 F4 P, V$ Y) U; G
5 ^+ A2 P0 T5 ~1 ~* A4 a: p
}1 _5 v2 s. M! v. l( {
else if (document.layers){! R. \* o5 x2 N! ^5 [
if (ns_marquee.left>(actualwidth*(-1)+8))% c" }& @! O0 I3 B% `- ]5 w5 H! o
ns_marquee.left-=copyspeed, [6 `' l2 x9 D( b7 l$ d4 o
else
' a( c- C: [" ~: h/ Yns_marquee.left=marqueewidth+8
- m. w+ F& y" ` T6 U}
# c$ _. B! O$ @* H: \}* _8 W3 D; J; f
! k0 c- P( P3 v+ o% y4 }$ \
if (iedom||document.layers){
( a4 Y; t( a+ n& X3 {6 gwith (document){
4 K4 C& U: D5 \3 Y1 ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
e( {1 N# G. {if (iedom){, [: g* Y9 J3 l" V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 N% C5 [0 Y# h1 uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 k8 T% ^: _0 s$ D7 f) Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ M* T: F0 C% n# X/ {, |6 ~" T, T) L' i2 wwrite('</div>')9 B9 i( K, R8 q9 _
}) o4 _7 v% v/ ]( K# T- z2 y
else if (document.layers){: K2 }. e/ Y0 n X6 M
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 A q! P5 l `( x! }( y) i; f4 y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 A3 d9 F5 a. r/ dwrite('</ilayer>')3 k. j9 k7 U6 ^% O! f# i8 _2 f B
}
- s" b2 ?# I F# ?& x* hdocument.write('</td></table>')
2 B2 n/ }7 Y4 p6 `8 |}5 q6 ?% H1 ]2 N
}
" t$ r6 j U; e7 x</script> |
|