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

|
网页之跑马灯文字特效
//修改宽度, m$ N3 g/ i+ E( b
var marqueewidth=300 w& n' m2 I: G3 \
//高度
% M; M/ K$ ^4 \6 s2 V$ tvar marqueeheight=25* i* @3 b+ L/ _
//速度(1-10). N$ ^" X" g8 w7 T) r
var marqueespeed=3& f5 m- H: T8 n. V& g; G
//背景颜色
+ f0 E! W2 L4 ~$ Y1 U+ f8 R# x$ svar marqueebgcolor="#FFFFFF"
" g- _- Q1 W2 e8 i4 c: l6 r3 c//是否能暂停 (0=no. 1=yes)?0 z: Q! j9 ^; O R& H
var pauseit=1! g: `, b7 e9 E( s
4 h3 s* c7 ~& E, {2 N" B
//修改显示内容3 r* a) |% k. ]
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 Q% j; D2 v+ }- T
& `; T' S* _) d3 U+ N
$ q4 B: N2 e5 Z- ^* Z; B' _" n////下面不需改变////////////: X6 H; q9 L+ M8 e. u3 V) D7 A5 U
6 v9 B; n2 I# N0 `( G) v9 vvar copyspeed=marqueespeed
! e9 Q- t9 W0 P: fvar pausespeed=(pauseit==0)? copyspeed: 0
w6 C+ l" _0 ?$ M+ N! Q" nvar iedom=document.all||document.getElementById0 M/ }5 I+ u- _+ G
if (iedom)0 |6 `4 R% i; W6 R* l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), P3 S0 Z1 |9 J" {( ~* q+ _
var actualwidth=''
( _5 d6 ]4 M/ F1 c" A7 }0 n* h+ avar cross_marquee, ns_marquee0 a6 F0 J3 Y# i }/ o9 m$ s
! R: B" n# r B% o8 u$ H
function populate(){! Y4 t8 e. s7 \' {# |2 B
if (iedom){
& j P& v: E7 L. e7 ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, Z( E0 [: u, k; ]cross_marquee.style.left=marqueewidth+8
6 ^$ o* A$ b$ C3 @& B' A* Gcross_marquee.innerHTML=marqueecontent+ Q( O# F# V3 ]: L) {: I' S: |/ b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% _/ f( q' j# e& s! N
}
0 R' v% [ Q# e+ R( `- welse if (document.layers){6 ?* \& u3 k. U* v
ns_marquee=document.ns_marquee.document.ns_marquee2
) I+ b" @: u) B2 P3 `( g5 ~' Jns_marquee.left=marqueewidth+8
; X7 e6 J! p" A) x/ \ns_marquee.document.write(marqueecontent)6 d# j4 A9 ~2 r% v4 Y/ j* K3 S
ns_marquee.document.close()$ z; t9 r% Z1 j; a; t. X
actualwidth=ns_marquee.document.width1 q3 S; ~5 V( P$ |. @( n* D7 W5 {/ g2 n
}
& b2 q! t0 T6 q2 d5 ?lefttime=setInterval("scrollmarquee()",20). I+ U+ g( f1 I; Y
}
. P+ H$ P: P% g: i' [: Bwindow.onload=populate2 W+ t, p- }: T2 M7 I5 B# b# ?
! n0 w7 _& ~2 K6 ^+ |& J/ A
function scrollmarquee(){
. ?, D5 Y* y3 e- D1 s wif (iedom){9 ~5 {" `) D+ i5 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# z8 L2 {- `, ]) s7 |3 n- N3 p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# A3 }. Z5 j; U! K$ y
else. d1 ?# D0 k/ _: {7 @2 N
cross_marquee.style.left=marqueewidth+81 q+ U8 F1 {& l, D1 h/ c
' `/ _8 @7 ^. ?0 w}
) X- k# v5 t) Felse if (document.layers){
/ q5 A0 B, x% Z/ x7 K+ H: \( rif (ns_marquee.left>(actualwidth*(-1)+8))) s3 G7 }" G J4 J# c, ^( O. l4 `6 U3 l0 y
ns_marquee.left-=copyspeed
/ [* Z2 e) U$ q+ Z7 W( c% a2 Relse. i$ o$ M/ p6 l! q2 ~
ns_marquee.left=marqueewidth+8
, Z1 C3 e6 G! w' J7 O# d}8 N! [9 H- W, F' B- U8 T- V
}
) D* S" q4 n; I( x; |
$ Q Q1 }! [ K# N. }( x: _if (iedom||document.layers){
" e0 k/ |+ d* f- M! w- t6 nwith (document){% v. N [" E2 ^& l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 L; @! _3 Q$ I& x
if (iedom){
% [$ K8 R# g! M6 Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* u: m( S; R- V2 h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- v7 y, E: Y' J; j! W0 e& T$ ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: l) Z) t5 f4 o, Y# G% {write('</div>')" u6 Z' q3 \: X/ Z
}1 e4 H" a* Y4 A! p. U
else if (document.layers){1 z9 i8 z1 {! @# ~9 J4 d4 ]4 @+ A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 x7 _) t0 I" ?4 i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 o7 G5 h( r4 @2 }
write('</ilayer>') R: C2 Y5 p' ]3 L/ B$ i2 [- g
}
4 ~" j( f6 Q$ J) kdocument.write('</td></table>')
$ o: v2 K% c1 T& y}
2 L* y9 g. R: s# `# b}/ Q& D+ \! o( n p8 W
</script> |
|