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

|
网页之跑马灯文字特效
//修改宽度
2 R0 o6 P/ I5 m9 K( W! _% Mvar marqueewidth=3003 s( V4 b/ ^) l5 Q! h0 c+ _
//高度/ f) j7 o. t, {6 A7 S/ S8 z
var marqueeheight=25% J8 Z7 y& B: d6 c6 C( P
//速度(1-10)
, p Z$ s) ^* p7 D6 ?var marqueespeed=3& Z8 `/ r+ ]& h+ Q) j9 q1 ], z: N1 M
//背景颜色
) X& {5 t% |" z6 l* b; p9 ^6 R( w$ Bvar marqueebgcolor="#FFFFFF"4 P3 w0 }$ k! w# O; M( l
//是否能暂停 (0=no. 1=yes)?; l' @) j( S9 l& a- n1 O2 o
var pauseit=16 A0 u# e8 T9 R. J* a g
1 X9 P( A$ F1 F7 T% j7 @
//修改显示内容6 n% E; m x% ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
p- a L0 ?9 N1 T- G* c5 F6 [% [0 P5 l( b4 w9 X0 A+ W1 k! V6 M. s
0 s2 {1 W% x A. M3 M
////下面不需改变////////////
; J5 h5 `$ J. u: i D8 _' T9 z
. e3 M) [2 W3 w2 U9 T6 k0 ~2 s8 Wvar copyspeed=marqueespeed$ [5 d/ Z' {, Y6 x1 S) a# e7 W
var pausespeed=(pauseit==0)? copyspeed: 0% Y7 f N' o. {" V
var iedom=document.all||document.getElementById, V& D u E4 j! ?' g
if (iedom)
, G; \( a" f: }) n$ Y3 n) |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' b/ ?$ U. p) e( O# N- k; {; [var actualwidth=''% [: L+ Q" c. Q$ F* _
var cross_marquee, ns_marquee
7 c: L8 V; ^3 [+ ?( K0 O- B# q+ m# k; H) _; U# d, j
function populate(){! s% u8 L8 V8 |+ _ a: R' M$ R! V
if (iedom){: N4 Q/ ~% s* b, g. ]2 y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 ]& {8 t# r8 H3 d* K6 L
cross_marquee.style.left=marqueewidth+8
! l# X, Y! s) w4 ?cross_marquee.innerHTML=marqueecontent/ g* ?+ F% `7 p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 J8 w) o8 D* l) f6 O# n1 i
}
* H& J. m7 C# ?) Oelse if (document.layers){
0 |; s3 \/ d ]5 @1 |+ N$ F! k1 O+ q qns_marquee=document.ns_marquee.document.ns_marquee2
7 [5 j: d1 i. b2 X8 e( y1 T% k3 tns_marquee.left=marqueewidth+8
& W. r8 O. r! z1 }. a$ m4 ins_marquee.document.write(marqueecontent)
/ U. g, {3 R" T& v# |8 A5 Zns_marquee.document.close()
. M& S u5 U" wactualwidth=ns_marquee.document.width
# Q9 y; b4 Z, J6 |}
0 D8 }: W) u' Alefttime=setInterval("scrollmarquee()",20)
4 f8 W& H# `! D3 Q1 e& u4 X! G) i}
( y9 C: k5 V# l2 I D4 zwindow.onload=populate
0 ?" P% y3 n7 e% [& K9 a! B( ~/ M6 W* U5 {
function scrollmarquee(){8 N9 v/ O% v. Q( F5 b
if (iedom){
2 @$ u% E8 _) fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' i6 g2 E0 y( Q6 H$ j. `8 z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: n, ^* h, k( N6 s4 I8 O M) _
else: a4 y1 {& X8 N! L; n" [
cross_marquee.style.left=marqueewidth+8
/ R& L" [# X, d4 n; \7 |* Z" W2 A! @" j/ c- w! A4 g! ^* G
}6 C; e; k/ ?( T& y
else if (document.layers){$ `+ b p; C, `' I: v
if (ns_marquee.left>(actualwidth*(-1)+8))6 U" I/ o) m4 m. f4 z
ns_marquee.left-=copyspeed; h7 j! ^/ a3 ~( p5 m! @ M3 s
else
2 S) D/ d3 k) j& G& ons_marquee.left=marqueewidth+8
, t/ z" |2 ^4 v9 k( w+ R}" W8 E* s, _! z" b( j
}
9 e7 n& f, I- q# w# D! t% `% g* H5 d, y3 f+ L! Z$ Y( q, z
if (iedom||document.layers){; a7 c- \& b: M# L
with (document){
" u! L" }/ ?0 f9 ?: Odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 `: r. `. N$ v: d+ }- o0 _" T5 n
if (iedom){1 x3 r T, t! b7 _1 @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 P: f9 J5 f$ H p O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( X4 g @2 G2 I% C- Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% [$ g( `& f* H T
write('</div>')+ F$ ~" ` f5 H* k, l$ o- Q6 G
}
; G5 \# V7 n; |else if (document.layers){5 I8 k$ [/ I4 T9 G6 X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& ~) |& e, x7 d) y/ t3 p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ \% c1 L( F' x& S
write('</ilayer>')
6 P7 b) d$ @) ^( n$ m7 p}$ u" G+ Z8 q* w) A: ^; q
document.write('</td></table>')! K6 g/ c. O" i9 z) c! X% d. T) J
}4 d' K$ `, G4 x3 H
}' {" W* }7 q, B
</script> |
|