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

|
网页之跑马灯文字特效
//修改宽度
4 B. T+ F$ x: [" p+ _& cvar marqueewidth=3003 y! K. w2 P, E [: S! {7 r7 U
//高度 y4 {# A( @1 v+ R$ d: w. W
var marqueeheight=25
+ C2 b1 |" J4 {//速度(1-10)
& l' J' R# |9 m$ a/ O1 x+ o- Lvar marqueespeed=34 m" g( M: r4 T* o B/ c: \7 N
//背景颜色
6 T- d+ h" ]1 i, ^" F1 Yvar marqueebgcolor="#FFFFFF"
+ B+ x* e/ ^; b5 F6 {//是否能暂停 (0=no. 1=yes)?
- P" E: x) \: N, n" wvar pauseit=1$ \: b$ P) X* v% z1 O' p! z
6 y( g) ]. B! Y//修改显示内容
1 P8 q% D0 O: w# ?7 Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ b; z: U j9 D8 y1 f5 Q4 c/ g7 O' i7 S" O$ D+ l3 N0 R% p
9 E& |) D" }6 ^' p, c+ W////下面不需改变////////////5 o, ? s k& b5 V1 a" H, I
! q* e! M9 `" q/ ]% }5 G" a
var copyspeed=marqueespeed
, o0 k* T: b% q& l$ D; Qvar pausespeed=(pauseit==0)? copyspeed: 0
3 y) k9 @4 ~0 v; fvar iedom=document.all||document.getElementById8 d' C3 V* ?- D
if (iedom)9 u4 q. Y8 M) i+ y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- g* r1 y( O7 L1 @9 |* }var actualwidth=''7 W% W. Q2 Q. f' U) e# k2 Y
var cross_marquee, ns_marquee
$ _% M8 ~" p; G# @6 k( T- b7 w- q1 c$ E7 J2 t+ w5 ]/ G/ O
function populate(){
0 P: w* A* ?8 W7 T/ S* a: A+ Iif (iedom){
) u, G( e( p8 e& V: d" ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( _1 r8 J" @" F; p
cross_marquee.style.left=marqueewidth+8, _* q' d+ p0 M; ]% t
cross_marquee.innerHTML=marqueecontent& N" u- J0 ]7 t, f- a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 ]# f) ^: V2 Z$ {
}
# j \9 i4 A* Z- R) Selse if (document.layers){. y/ R$ Y- N0 m6 I" W2 W
ns_marquee=document.ns_marquee.document.ns_marquee2% U* f |' a+ D" ~( P! l; b, G
ns_marquee.left=marqueewidth+88 E& S6 W( s; y% B
ns_marquee.document.write(marqueecontent)
- v5 x* a& B: V0 Lns_marquee.document.close()
0 i: }" B* f; W4 e9 o' pactualwidth=ns_marquee.document.width w' |1 f0 A/ ]; Q7 M. J
}
3 J3 ^' W2 d! t: s* ^lefttime=setInterval("scrollmarquee()",20)1 u4 {: Q: j: ~
}1 k' f+ x! m3 a( a3 w: {
window.onload=populate
/ n0 `5 o" n9 G$ _5 }! U9 b( p- ?- N- j
function scrollmarquee(){8 ]% J% g( c$ J* H! {+ |
if (iedom){
2 ^; q8 D' n8 P0 n" a3 }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" n1 f* ]; O1 o- z: ]3 \9 m0 v' c! P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 g; E2 l, ]. h3 d7 ^+ x- \9 G3 x
else8 y: R# `. @& v$ K% o) C
cross_marquee.style.left=marqueewidth+8
) _' t& Q# l, |. F/ W( D0 U7 E, i* c: P1 b0 g! {, n
} D1 w# e& m: b N' X2 i& S
else if (document.layers){8 j% J" b3 ^& H2 \- `
if (ns_marquee.left>(actualwidth*(-1)+8)), p6 R" h4 I0 M4 u5 r
ns_marquee.left-=copyspeed
# h7 Z! y& M8 h; u7 q/ Celse
. [% z& A+ v0 i1 K+ ens_marquee.left=marqueewidth+8
0 R3 d3 a. R- }1 W% ]5 J' T( O}
& g1 y* G, x( q8 c7 ^}
/ F' F( p$ d# {0 y+ z8 ]/ Q
& Z0 v& {' o# _' {& }if (iedom||document.layers){
- g4 ?3 D8 ]: U+ c) c) Kwith (document){
0 w+ u `# {" Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' a/ z* U) C* h8 t3 p8 O1 x
if (iedom){
6 R0 A' j+ w9 |& Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ Z7 x& A7 B. E' g. W5 q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. T3 E/ F4 m; V7 m8 |9 u: B. ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* |3 f4 n1 w2 K0 W
write('</div>')9 s } `, K( m
}
2 j* a' b. \9 ~6 ?. yelse if (document.layers){+ |, F0 q/ H, z, u& s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 L5 K/ ^! `/ y, n W- b% p9 R. C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 B7 ^# ]8 a& p& j" v. U" _write('</ilayer>')
6 h! m- u& _8 ?5 E" R0 r: C! E; O0 J}
9 T: t: n+ D' @+ P5 R5 @& c3 jdocument.write('</td></table>')9 _6 j; r( Y8 `% x T
}, O3 ]8 ?5 v: f) p; p* W
}
- u l$ P3 a( u4 T</script> |
|