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

|
网页之跑马灯文字特效
//修改宽度# v6 W, @1 L( X& x% e
var marqueewidth=300$ i8 L' S& _9 p( z P
//高度3 D! @0 ] V" q
var marqueeheight=25# N; ]6 t3 C l3 h$ P# q: i0 k
//速度(1-10), D' k( f( z, m. F
var marqueespeed=35 D) u/ j! h, u; S A7 V
//背景颜色, O \ f: p/ ]6 j A2 K4 X
var marqueebgcolor="#FFFFFF"
8 H c- u" c2 R4 f: v//是否能暂停 (0=no. 1=yes)?
0 b, Z( w8 {$ T, |3 y+ fvar pauseit=1
t! ]8 Y3 e4 ^' H+ q* `
( i. J4 C& k9 r- n//修改显示内容1 x w# n* j& q: D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" q$ @, M+ [! P+ V9 H' ?& ~( u% t
4 b) v3 j8 q. m2 I
7 E" z7 K; [6 t# `////下面不需改变////////////& j7 B( N: c& u! n$ n6 R: e7 z
& ^: B$ J# ^ ?$ V% @
var copyspeed=marqueespeed3 d) T( {1 j. R X+ ~+ B) t1 B% F
var pausespeed=(pauseit==0)? copyspeed: 0$ Q6 q5 ^4 R9 o7 q. e; P
var iedom=document.all||document.getElementById+ q p! ?9 L8 [9 z
if (iedom)
8 S5 M) I" w/ y; w2 F$ Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- ?, e3 j6 L. g# d p* Uvar actualwidth=''
; @* J5 o7 \0 W Tvar cross_marquee, ns_marquee7 m0 d( a1 w1 F X ^! _8 U
+ c4 F3 e; x0 |9 E- e" v Tfunction populate(){
) M6 w9 m1 d/ F3 p( ^, T/ ?if (iedom){
, N2 T( z" S* G( M) H4 x' I+ D7 Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 T8 |' B, ] c4 Across_marquee.style.left=marqueewidth+84 J6 S3 u3 c0 |' ^
cross_marquee.innerHTML=marqueecontent
& i g( a& i$ x& Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: d& I. s2 }) i% V( h1 u}$ C7 u5 n! {9 v `8 W; Z3 f1 c
else if (document.layers){
4 S' |' x$ }! N8 @& w2 Zns_marquee=document.ns_marquee.document.ns_marquee29 J/ N \* Z Z, ?+ l
ns_marquee.left=marqueewidth+8! L8 S4 R. a0 ^/ w! b
ns_marquee.document.write(marqueecontent)- J+ {0 d, ?& b6 y, _
ns_marquee.document.close()' B% r2 t1 Z6 Q3 a' {/ A
actualwidth=ns_marquee.document.width& v" G7 r! y/ \- }8 p
}
+ ]& X2 e: U5 b+ alefttime=setInterval("scrollmarquee()",20): E9 R4 A+ `$ f- P. q5 ?* k
}0 `* \: q) `+ e% N+ t
window.onload=populate
0 J0 T8 K8 H8 p5 P5 c. P) N9 d3 U5 H. f
function scrollmarquee(){6 N' i. H9 l! W0 b# T" U
if (iedom){; L! {, |3 k! i- @# C4 x" v( w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% [* t7 a# O% i ?- @
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 l C* \6 [0 C
else4 w" P4 o/ B2 E9 M- C
cross_marquee.style.left=marqueewidth+8: O* c+ J2 N3 v. I
& n6 u% D; f9 G# s3 _
}% ~2 W% j; _8 |& V7 n
else if (document.layers){' j$ D. K7 u& I* X0 A' z( M4 \' w
if (ns_marquee.left>(actualwidth*(-1)+8))& [3 A. l+ G- e& Z1 V: h. A; D% I
ns_marquee.left-=copyspeed
5 ]% B. v3 y* E6 h; P9 u! ^4 Yelse# N/ l1 e9 j s) ?8 a6 {3 ^
ns_marquee.left=marqueewidth+8
+ J" a. T( k; }7 p8 D" j}
; h- @4 j. |# h5 W0 J* o# C" i}
1 ^+ K! V% S4 }0 _; U- y' N# h- S; v4 e# T& {2 e. @
if (iedom||document.layers){" U7 V! n, f" b3 p6 _' u
with (document){
* o2 y- a7 z7 j- [' ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ q% ~7 n g* q
if (iedom){8 X/ N B1 t! _* m8 k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: H" J" }7 h- Y+ Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 z; o# ]! l. {* j7 d1 v2 r u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& L, e8 f) h i# f; W0 \write('</div>')
; ~# h2 `# y) J4 B1 a. Q}/ d0 l% r, V2 m+ F8 v3 D
else if (document.layers){6 Q. x8 ?; y$ A7 `8 g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), i. d2 N7 L2 u9 B) Y9 t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) _3 y) s' b& A- f+ u& Zwrite('</ilayer>')1 `2 z& u$ `1 J5 i( Y8 U. M
}
- I: G J- X/ h) j2 u0 n. hdocument.write('</td></table>')# K$ m9 G1 n. Z& {3 H. V6 F
}! V( T( \! I8 Y. C6 A% L9 P" _4 W
}
3 T0 i u. N2 x) |</script> |
|