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

|
网页之跑马灯文字特效
//修改宽度1 V: N# M. s2 u+ b& X7 t- Y5 ? z6 S
var marqueewidth=300
& i& v5 Z( m# Y- y//高度
' T) `* x! N7 V3 Yvar marqueeheight=25+ h2 R d" H6 _0 x8 {4 P* }, U/ _* b
//速度(1-10)
' S! W6 T+ B4 i6 Q$ m1 Y2 cvar marqueespeed=3" v; @5 T6 X5 c4 Z/ \7 l! J
//背景颜色4 Z; [9 _0 n+ S4 }( @% t/ ~# j/ n
var marqueebgcolor="#FFFFFF"
! `( Y2 X C1 o6 @//是否能暂停 (0=no. 1=yes)?1 n# M2 Q& e* d) Y
var pauseit=1
' O$ ~5 I4 |! m2 D9 G4 k. D4 ^) I: c) ~; m: l) [$ \$ c
//修改显示内容
. ?/ B8 ?3 S( J! ?, @- [9 Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' E; g% M% _. [5 W6 q$ w# @
- W) W( K u7 U
% n$ a+ x5 X: w+ }& K/ W////下面不需改变////////////8 j( e k: F& v. `7 M
) p! b$ ]( I8 V6 O6 X, avar copyspeed=marqueespeed
5 Z; v' }( u9 m Yvar pausespeed=(pauseit==0)? copyspeed: 0
+ z4 X! S# t9 S. Hvar iedom=document.all||document.getElementById
* o$ S7 {* A+ t6 n2 hif (iedom)+ s2 F1 A. {" C0 }8 Z' f1 t9 F: R& Q( a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( I) h! e- H- g9 }1 N
var actualwidth=''
$ S0 S" h+ Y0 F3 S# R3 X t1 evar cross_marquee, ns_marquee) |! X& j( h7 s4 E7 |, }
5 S$ _1 ^6 M3 L$ C+ v
function populate(){
2 {3 u& b7 M8 C! `- p% Sif (iedom){7 m+ D; G) _3 ?% a1 r5 W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 n) t+ z" c9 r" a7 R7 ycross_marquee.style.left=marqueewidth+8: Y, l4 W& p7 i' O
cross_marquee.innerHTML=marqueecontent
9 I% @2 Z5 |/ Z: q6 `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 M5 x. N s2 o% u' i
}) E. m% z9 ]$ B0 W' P
else if (document.layers){" f p% }( M8 v
ns_marquee=document.ns_marquee.document.ns_marquee2
$ `# K) W# e5 Z: I( Zns_marquee.left=marqueewidth+8
* N: M4 E5 \" r/ pns_marquee.document.write(marqueecontent)2 a+ M) O5 |! P! ^5 O/ Q6 f; J
ns_marquee.document.close()
& W$ x6 F7 s4 V uactualwidth=ns_marquee.document.width+ Z8 n' I5 e# k4 {* Z
}
: n! l1 l( h+ w5 Blefttime=setInterval("scrollmarquee()",20)
6 R& \: C: S l" t4 |}$ F5 b! v$ B/ R: q/ s8 H7 z, B5 `
window.onload=populate
8 W3 C$ c! ?* d+ }
2 S, |2 A9 P( s2 \function scrollmarquee(){
) Y$ ^! L# u% z) _; j. q5 {) @if (iedom){4 Y- a! L( t8 U% V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 I0 [8 ~# t- m: Z7 A
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 ]( P* k: C* R7 Uelse6 S9 F9 @! T: R1 ? M2 S2 X
cross_marquee.style.left=marqueewidth+8
}% c1 T# z5 L% s6 Y5 z5 b0 }7 E5 M9 s* L9 B4 |* n
}4 |0 k# e$ v+ c
else if (document.layers){
& f% ]: x( V) w, mif (ns_marquee.left>(actualwidth*(-1)+8))1 ]' Y. C- Y/ v+ W* P: M
ns_marquee.left-=copyspeed9 z1 k- F# C$ U5 a6 t
else$ J2 {; p' M% a2 s( Z
ns_marquee.left=marqueewidth+8
' l, x* ]. {* Q D}0 B; ^/ U' i, l) z/ o* h, S {
}
: h7 F, ~6 e* t5 v' o1 M1 `0 W4 }* x/ M# D( t
if (iedom||document.layers){3 R. E5 v. {& N5 O. V. [
with (document){& U. P9 g9 t$ q' z; a5 ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') S6 Q4 b% f& Q9 ?' t0 g3 w% v
if (iedom){
2 b7 `/ P9 x1 j5 m) \5 n8 x5 _, ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 a% M7 s0 x8 W, Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ u/ M I! o$ f6 @" o4 C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% _* H3 z3 c9 C$ wwrite('</div>')1 Y0 ?1 ]0 u6 f
}
2 @; B/ n+ M0 e8 V" G+ f. s X8 [else if (document.layers){$ r$ ~, y r3 {' [ e# b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' y; `! Y4 x( x5 z0 X( W. {8 jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 m# o! ^/ z: F( M- _, n
write('</ilayer>'); \- Y! m; a, S
}8 b/ v% M" h" D1 T
document.write('</td></table>')
1 p. w, @+ R, L9 E9 N; ~}
& o- G7 S, l0 X3 U# @- E. H7 N}
. ~4 L9 Q/ y9 u3 L</script> |
|