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

|
网页之跑马灯文字特效
//修改宽度
3 E) b$ w$ a N! Vvar marqueewidth=300
7 Q# d H( w6 g* d1 e) a//高度
& N. k' V' [+ Yvar marqueeheight=25
& L! }! V9 }& r, F" V7 P: j//速度(1-10)5 r9 q; Z% D' b( W2 l
var marqueespeed=3
5 W0 P5 Y0 j" b: ]. @( Z( B9 M8 k//背景颜色6 {2 y7 _1 u) S1 J3 l4 I: F
var marqueebgcolor="#FFFFFF" K+ _8 f( q" b1 _+ T( O* p5 A
//是否能暂停 (0=no. 1=yes)?" z$ ?$ Z! s* H- I3 W X3 n
var pauseit=1
- B7 U7 d/ Z0 u1 p, F" V- K, V" U
//修改显示内容$ e2 [9 ]) ?. I' w6 R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 D! h3 g! f5 }& ~, A- J) f" A
2 a; ~5 _7 Z3 S; v- f- s8 w; v
////下面不需改变////////////
2 e/ Y0 u( m* P4 G+ `
5 @3 X! b3 D+ f0 lvar copyspeed=marqueespeed
- M1 A- X: o+ Uvar pausespeed=(pauseit==0)? copyspeed: 0: n8 f$ M+ {, |
var iedom=document.all||document.getElementById- H; {$ g. ^3 L! s
if (iedom)) ?4 ]+ Z0 N/ c' o9 |9 Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ K8 N- G, ]; _ x' q# D( N M
var actualwidth='' v8 ~6 V) F- k' e
var cross_marquee, ns_marquee p$ S5 Z2 `6 j1 x& w! ?
$ U3 v4 v% T- e' v0 R! R# E
function populate(){1 {8 O! E! k6 r) E
if (iedom){
7 X5 ]; i4 M8 n* o, Kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; H) y# L: f6 r3 F: U% `* ^3 j L, Q
cross_marquee.style.left=marqueewidth+8$ M! ?& `6 ^0 Y2 M# R) p! T. N
cross_marquee.innerHTML=marqueecontent
) I1 v. B P9 \6 ?# u) pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- m" ]4 g% W" r8 Y; I. [2 ]}8 A& y! j$ U! c" N. B% e
else if (document.layers){) O5 ~ n$ s' _$ f0 D ?% b4 N
ns_marquee=document.ns_marquee.document.ns_marquee2% d7 Q. }2 Q. \% V' b- T7 O
ns_marquee.left=marqueewidth+8
6 H9 S. w. q5 D; {& b ]ns_marquee.document.write(marqueecontent)
1 \6 m7 `6 v& \ dns_marquee.document.close()) T" m! R% m$ f- ^: \2 f
actualwidth=ns_marquee.document.width
. v- |9 Q5 H U' O: G2 u}
2 p# p" N7 C# r1 j" |- ]lefttime=setInterval("scrollmarquee()",20)) c2 S( A5 x- L+ Q( A3 L5 [. q
}' A/ d1 K7 c4 G6 J2 s5 Q& E
window.onload=populate
1 Q8 T: ~8 N# m) y" Y: I8 r
+ w8 y8 d/ q2 R5 ^' I) rfunction scrollmarquee(){8 L l1 @, B! l9 j& }
if (iedom){$ C# s0 a5 i9 x) x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 |( K. o5 @6 W/ ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) r* s. v5 z6 X. x. k. I: ~else6 y( b+ @) F% n. L T
cross_marquee.style.left=marqueewidth+8
+ M7 G, C: O3 H7 R' o9 C( x& N8 x$ B
}
! O. F' [3 d( h9 v$ celse if (document.layers){
5 j- X8 n. H* N# ^3 L. Vif (ns_marquee.left>(actualwidth*(-1)+8))
( N/ G! R8 o# \6 p: X8 b. ans_marquee.left-=copyspeed
- {4 c$ O# }: }/ celse( L, m( _) e+ Y
ns_marquee.left=marqueewidth+8
i$ m$ X: c* P. D) e}# i0 Z, n U y; `
}2 m! i6 C( \+ x: I: D; E
+ Q7 }# _) w& t
if (iedom||document.layers){
) u/ C, e9 I, {with (document){
" o( |3 C2 s/ Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 F* Q& v" E& \if (iedom){' L6 F6 N& ~) |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& {% k5 z, Z' h/ p7 J, F
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 f4 ]6 P, {5 f, e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! n) D. O0 C# Awrite('</div>')8 G$ h' T/ M5 M7 h9 G- }" n6 ?, p
}9 l2 j3 L* _/ L/ t' @/ p: f
else if (document.layers){
+ |3 { ]( `* f/ u& e! G2 \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# |! i9 D8 U7 g+ @3 c4 Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
b \% a: M2 i- q) uwrite('</ilayer>')
) B" [2 L$ d- D0 W}& n& R E/ z! |4 k% c; y Q0 }
document.write('</td></table>')
7 y9 x- r3 ?& F- A: v2 d5 l# |9 s# ^# Z9 v}: _* K: h c0 x2 K) I: [, f( u
}
|( r9 y" p! L, x</script> |
|