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

|
网页之跑马灯文字特效
//修改宽度
# R; k+ N" l4 A: R/ M8 e9 svar marqueewidth=300
# X7 `/ Y- y& s2 H0 _& g) i$ A//高度: b) _: ^- s6 d5 Q7 Y5 i
var marqueeheight=25$ n3 ?% M; E" X7 P
//速度(1-10)4 w: [! q& Z( Y# z) ]0 N$ z g N
var marqueespeed=3
; F( \7 V6 \$ t7 Y" f% O9 D) D8 r//背景颜色
8 U* J7 N% E$ f: |5 Cvar marqueebgcolor="#FFFFFF"
; `% g9 ]) v! Q4 {//是否能暂停 (0=no. 1=yes)?3 L0 V. @& b& P1 q- j! }
var pauseit=1
: T% s g% w& Y+ s& @1 u) S* |# x0 U6 G# w1 }5 A
//修改显示内容$ w4 w$ ^ D9 r* d: |& D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: i! {/ c1 |8 a6 ]3 P1 a6 _: G! B3 z3 Y& n: [. ~4 k
. }0 {5 H3 K9 w# e& Y" x, T
////下面不需改变////////////* c7 X: l6 V& k8 N
+ I9 L5 s# H" {4 T" C) {
var copyspeed=marqueespeed
& H5 e# v2 m; {var pausespeed=(pauseit==0)? copyspeed: 0! i% M. m6 C" U$ i
var iedom=document.all||document.getElementById
1 |7 m* X* f- r. Xif (iedom)
1 t! M8 ?; f, x' A' Y0 j6 Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 s) p$ A |* I+ t- Jvar actualwidth=''
8 u; _- M) L; J* j; qvar cross_marquee, ns_marquee8 s7 |9 |( p9 E) I, `, w
$ a$ ~' k8 _$ yfunction populate(){% H1 i& D+ i7 ]& w4 {
if (iedom){
1 B) f) F2 a/ t3 qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- e$ K3 O* Q5 C9 Y, \cross_marquee.style.left=marqueewidth+8
5 l6 T( A* |! g( ucross_marquee.innerHTML=marqueecontent8 S6 S' U5 `& o3 N/ x1 T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* [2 y3 j6 M" C) D6 \- Y
}
5 N% z# I2 V* O/ w# velse if (document.layers){
1 E0 U. u" L9 h/ N6 [; rns_marquee=document.ns_marquee.document.ns_marquee2
m' B% Y& E* q- U) ~ns_marquee.left=marqueewidth+86 Z/ N" k, c6 o
ns_marquee.document.write(marqueecontent)* Q( D' s: j/ \
ns_marquee.document.close()
; I) a6 Y& ^% D; ^+ E6 ~* Uactualwidth=ns_marquee.document.width
5 @7 H H5 k) u' a4 @3 ?}
/ C8 Q) @- k- F% ylefttime=setInterval("scrollmarquee()",20)+ a% {& t1 R* f# |- U% \
}
0 Q5 w/ _: J4 M1 a9 Ywindow.onload=populate
2 O% _" t* d/ d ?8 {2 E2 c2 }4 \8 U( M+ E K1 D- l
function scrollmarquee(){' Y. U; J6 {3 j7 y; u1 W- t3 e
if (iedom){: @8 m3 M- W+ U2 Y ]. e/ l9 V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% U; H. u, r5 b% m' [& Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 Z, M; Z0 h! Ielse5 S3 j) x) r( g! O v% z! S" N
cross_marquee.style.left=marqueewidth+8
$ a1 H' p- |8 c8 f$ `- F% w K' q: ~+ I
}
+ \0 q* t% S+ R8 O4 r9 k8 d; felse if (document.layers){" n' b5 k8 R2 ~2 g2 q; K2 J
if (ns_marquee.left>(actualwidth*(-1)+8))
+ L( P2 o) r' H; V' I; a4 \( L$ }/ \ns_marquee.left-=copyspeed _) m9 ]3 b; {7 a
else, ^ c0 m% \) A9 g% v+ r( B3 P
ns_marquee.left=marqueewidth+89 ]& _+ u9 l F: z n+ {: ]! r* ~ |, i
}
/ w# b. r+ `* L}
6 k# b: o% s/ u; S+ D, ^
1 l* `! i) e. a: rif (iedom||document.layers){, m- E0 z6 _( y5 Z0 l; X! Q
with (document){
* l- ^' O% z! ], p3 ^+ k3 V y5 Hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 N# \* N. `& g9 T+ h. d- U8 pif (iedom){2 u H/ l5 W3 J" p/ e5 {5 j1 o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 ]7 A6 T! D; g% n. o$ Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% U7 g$ |# L& }6 _0 }1 V7 A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. y0 S( w0 l* W1 m% z; twrite('</div>'); ?( N4 e& ~' @3 P7 ?3 R8 n+ O
}' N3 m; M' X! w. j% e5 C. V: q
else if (document.layers){
) e7 k; I* n0 \" H2 u9 N8 nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 y/ I5 o# n& Q7 K/ m3 ^+ V
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* R) Q# H0 N/ _) v' Hwrite('</ilayer>'): h" k, }9 c& G
}
6 Z$ {$ D, K' q5 Bdocument.write('</td></table>')$ s/ w- _3 x) P# M6 w
}. y1 I$ o. |9 ^
}
0 Q% s7 L; n, Z$ i1 ?: p- }( X9 ^</script> |
|