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

|
网页之跑马灯文字特效
//修改宽度
% m4 J/ e7 Q0 s( m5 @" uvar marqueewidth=300+ _; i7 a1 ?6 H. A4 V/ B6 T
//高度
8 i! }3 R4 B3 c" Kvar marqueeheight=25
- o3 w" u& H) U7 S& j//速度(1-10)
0 h# J; n8 {* M# Vvar marqueespeed=3) |" v2 m( |: R, v/ j
//背景颜色! W8 t1 x5 M8 ^( G% h
var marqueebgcolor="#FFFFFF"# i; e; B2 X5 ?& f1 l
//是否能暂停 (0=no. 1=yes)?$ L o+ r% g& k4 A; a! c; E( ?
var pauseit=1$ W8 w! k% ~2 v) n5 ?
8 }" B; p" Y4 b$ d
//修改显示内容: Y( l6 e$ ~6 k: Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ i- C* s+ `' M
* X. J7 ~% \, z
3 g) J) T. f6 N) E! n: }! e, w////下面不需改变////////////$ F0 F9 k& v/ u* C7 W
: p, |& j& N8 h
var copyspeed=marqueespeed' K% q# L* w4 q2 B5 ^
var pausespeed=(pauseit==0)? copyspeed: 0$ s( A0 w& ^7 G% i7 q; i
var iedom=document.all||document.getElementById
' e: j# l7 L4 J- `1 i8 h7 M. E' L# p- wif (iedom)
% z( `9 D1 b' a; H$ Z0 j' Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 |* m/ V5 K( v. ?) y4 f6 yvar actualwidth=''1 S" A$ b8 h7 r5 ?
var cross_marquee, ns_marquee
4 P, n5 h3 n7 N- z8 N# f& d4 z/ z. e( @+ ^' V9 r' I5 D: \8 t
function populate(){
I: n$ r/ K$ d6 G3 q1 U" g w3 U wif (iedom){7 ~: W, _7 J! ^: _8 r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' S8 F8 J3 ` o K: ?. W) Ncross_marquee.style.left=marqueewidth+8
5 S+ C. K4 i8 L! P( wcross_marquee.innerHTML=marqueecontent
' b( M% O7 z0 z9 E! z' I. t3 Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 M/ N% P4 X$ n! M/ t: ~! H. K}* n3 T$ f& [1 c8 a8 x4 w$ D
else if (document.layers){9 @5 ]' ~! b/ Z9 F5 b1 I, ]8 Z+ D
ns_marquee=document.ns_marquee.document.ns_marquee2; S0 D3 O4 D* ~( S3 f6 h
ns_marquee.left=marqueewidth+8* h( w: @% \1 ~3 U0 w# n
ns_marquee.document.write(marqueecontent)& h" m- s0 e, A$ d% b
ns_marquee.document.close()
8 w+ `1 V3 r2 m- _: U; Cactualwidth=ns_marquee.document.width
- P v; \ Z; }% |}
J7 C/ [$ ^: I* l/ ulefttime=setInterval("scrollmarquee()",20)0 J, @6 |, m, a$ V& ]! y- Y9 D
}
" E: Z' ~+ h# k) A& E* Y) I' \window.onload=populate
' _4 ?" Z; M! n- z, ^: `
5 e0 _4 z9 D/ F0 q2 l! mfunction scrollmarquee(){
! z' T! I* a. c1 rif (iedom){4 e5 R/ R5 r0 J* g5 O" ?5 R: }
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). f, N7 w) j; g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; T+ D' `. Y+ D* g' o
else& U E: j; l+ T! @
cross_marquee.style.left=marqueewidth+8: H) t" M6 C& G3 i
4 f* z/ d5 r/ X+ A9 W6 I}
5 U7 h- Z1 K" V9 E& ~" h0 ^else if (document.layers){
3 P+ I% k S' S) X* L. m6 d7 jif (ns_marquee.left>(actualwidth*(-1)+8))
" d, ]* p% ?) y$ D; dns_marquee.left-=copyspeed5 C; j6 u! d6 g! {; P2 A
else# U7 U1 J b: }7 X" n6 Q5 ?
ns_marquee.left=marqueewidth+8
4 ]' k5 Y: |( w6 a1 {/ A' }% A}
+ i" K% I( _8 O3 [( j" }}
3 V+ p; [; ?1 T' w% R! h6 y! A+ u, d$ c6 D7 s
if (iedom||document.layers){
4 T0 ]" L" u; i" V6 pwith (document){
* R# k4 I! a P, Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& A# C& [' s/ U. Q2 w) X3 Hif (iedom){% _+ a% s/ @5 a0 X2 y# v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): L5 ?: K! P$ q& j
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- z* F2 i* k" l& T. G. |' Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 D, r% k! P! w* W7 Qwrite('</div>')
\1 B- l$ m; o' q4 s: \- G7 O}
! J5 @2 p# a$ C; D) o7 G5 g# uelse if (document.layers){
}: G: g. |" S e" Y2 {- O9 P* u! qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* p' p" B# a5 L6 r5 M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. y8 f: C& _1 t0 Q6 D& Wwrite('</ilayer>')
2 M5 i( o4 h; V8 i}
# b5 p& y( e. ]! `document.write('</td></table>')! x( a' b6 Y8 }1 y5 p
}& K W; a5 G6 R) ]% }
}$ ^0 N( t! v5 k9 h; s# z
</script> |
|