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

|
网页之跑马灯文字特效
//修改宽度 l) Y# Q" ? E X" b v4 k
var marqueewidth=300
+ ~# R! [8 ^7 ~+ R//高度, U/ m# f! T3 _) A( q7 l* `; |( m& e
var marqueeheight=25. C: y( L: F4 V. R4 w6 \) L
//速度(1-10)
1 z7 R+ o! O' b! ]! d9 wvar marqueespeed=3
4 g7 r3 h# t! ?& y4 P: e% Y' V//背景颜色0 L/ U9 f6 M7 h8 p: {3 y" X5 b
var marqueebgcolor="#FFFFFF"
$ P# Z U# q( k* m$ y//是否能暂停 (0=no. 1=yes)?
, {' M. k# @" y1 u; mvar pauseit=1 x3 |) T7 s9 {2 k9 _1 _
2 w0 S* z6 F7 O1 K% x c$ n+ l* T4 @//修改显示内容- y" p j! d/ G. U1 w2 W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 _/ Z3 b( D* x( h" d
( ?+ G, t# a& U$ c% n
# Q9 p- n' p$ d0 N; [' L
////下面不需改变////////////* H0 f& N" T! i7 `. V1 G
* c" c* F" t! Q5 Pvar copyspeed=marqueespeed* J ^8 Z# K/ X; W0 \+ z
var pausespeed=(pauseit==0)? copyspeed: 0
6 Z! `% o& }# w# A5 F& b* evar iedom=document.all||document.getElementById6 R" T( y8 P+ v: u
if (iedom)" P5 |, m4 ?3 l7 s# J" t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 T+ s1 G9 g. e) {, _
var actualwidth=''
2 P7 F/ K1 Z. C& E- |var cross_marquee, ns_marquee7 |% i0 ]7 Y1 Y; l" x0 {1 r8 I9 f
* s. {$ m/ B3 P: i2 x, e! b0 Ofunction populate(){
, o8 P# f' S, C5 s% }if (iedom){. G1 T0 e" C/ s! |' t0 S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- Z$ i; P9 Y3 across_marquee.style.left=marqueewidth+8
8 G* z6 G9 m& across_marquee.innerHTML=marqueecontent
9 ^4 @- j: D& k8 p4 gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. X& w: h' b( J$ K5 R' u0 o' M# J
}1 o! g0 E+ `) J3 _! `. k
else if (document.layers){% L( b5 y! }& K# _1 _1 S" [/ i( Y
ns_marquee=document.ns_marquee.document.ns_marquee2, ^. t9 Q4 E% T, [
ns_marquee.left=marqueewidth+8+ H( A+ y6 {5 {/ T9 R
ns_marquee.document.write(marqueecontent)
" ?0 j6 ?8 c7 Mns_marquee.document.close()! P, e7 s$ H9 p& B
actualwidth=ns_marquee.document.width, d# s) h. j8 O4 _( A; H$ x
}
0 h h" S: y, \5 C3 e0 llefttime=setInterval("scrollmarquee()",20)9 b2 s, @: C0 \; Q& O
}
9 Z; |6 q+ x# t# D" x; f5 kwindow.onload=populate( f5 S/ X2 L! F4 E
}$ j+ f, z a
function scrollmarquee(){7 f. {0 W( R0 R, J: R
if (iedom){
' I) O' D$ D. D ]( D- s' q& iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) w/ s3 s2 h/ N% ^: l5 scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
?/ \ E8 ?; celse
- x% R: |# u: a2 j q6 qcross_marquee.style.left=marqueewidth+83 `, {0 s6 u" \$ L/ [; s" c0 ?
* T! c- O( x4 m9 e} @( n- F! W. I# h c. P+ e
else if (document.layers){) Y* L" y$ f7 \5 N; K& \! S
if (ns_marquee.left>(actualwidth*(-1)+8))
4 F; K! ^- B: A6 h3 ~. Vns_marquee.left-=copyspeed
8 G3 f" ~7 C# {; P9 s" uelse: }6 W2 V. [! U" \2 x
ns_marquee.left=marqueewidth+8
8 j6 ~% R, X0 Z& q5 T6 V& \% M}5 m% a9 f: |4 p1 e+ q- m$ X8 b4 s7 C
}9 A9 @3 T( X( j- p* u. l
# [" Z2 P2 w2 _9 s, l' ^
if (iedom||document.layers){5 r' @* _* p- k
with (document){! @& I, N" d+ I7 u6 e/ j/ t- l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! E9 P0 U7 v8 f' X3 j
if (iedom){" E6 ?% Y' T# C3 z, b! c8 x; n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- x8 R2 L; F/ I: _
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- Y$ O4 ]. I/ }/ z" x9 w% c3 m5 ^+ kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ E& M5 T8 S: k- r& Y1 Awrite('</div>')( \) u8 v; z; O1 }( C
}
7 o: h& L2 }) {, Yelse if (document.layers){5 r4 Q- Y! X! u6 U) d$ R: _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( R( @; u# s" ]! F2 d4 kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ ~; t8 M2 U, ~6 ?7 E
write('</ilayer>')( k! N7 n0 d! A! a; Z; [
}& m: B2 Z* t; j, ]$ Y& v% L7 N
document.write('</td></table>')
/ V* k; e% b4 H% R' @}7 e& @! l( U- ~! [# R$ I- D, y
}
_; k6 s* ~3 _: d8 m7 [0 h v</script> |
|