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

|
网页之跑马灯文字特效
//修改宽度- N1 P: [7 e$ i* g. u
var marqueewidth=300
; `! F3 H2 H3 Y: c! i: A! D' f//高度( {' f( z3 R- i5 q3 Z+ G# {. v1 C' {
var marqueeheight=25
4 m! ^; K4 V: A9 @7 [//速度(1-10) }/ m1 b. L& e! d# t# @
var marqueespeed=32 _1 w. b. T9 [: K; n
//背景颜色* V. f# |' b7 |0 w9 H# F
var marqueebgcolor="#FFFFFF"
- g/ D1 S- b) w. M3 I) l3 n//是否能暂停 (0=no. 1=yes)?2 _5 E2 c; w* O, a' x( W$ @& c( B+ w
var pauseit=1
+ S' S6 j; \( E9 B+ A0 x7 O( K: f) M% A% v' Y$ \+ F; a
//修改显示内容
0 h# _. D) k! q9 d3 j) K6 avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& L. x6 h5 z w6 f7 |7 u
& r: `3 a! n" `( m8 l
4 a1 N) X; D- i2 J////下面不需改变////////////1 c9 D8 a' B R. X
1 \2 T' i- o. F% m1 \var copyspeed=marqueespeed
4 D0 o# ~9 K3 Z3 gvar pausespeed=(pauseit==0)? copyspeed: 0: Y& N9 z& b0 j/ a# P
var iedom=document.all||document.getElementById
$ w: ?7 }' V( @" x' Rif (iedom)# e" F9 w; G5 h) L6 Z+ F6 f$ h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; y% R: F$ V5 U5 gvar actualwidth=''
7 d, w/ H3 K. f: Qvar cross_marquee, ns_marquee, ]* F7 m4 x/ e/ M1 z
7 E* Y, _& {0 j3 I: jfunction populate(){+ f7 [0 q; j0 v# d4 o
if (iedom){
' s! _6 Z# ]7 ~/ Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" [0 ^3 x2 b( T3 [
cross_marquee.style.left=marqueewidth+8
! C( O* `) z: vcross_marquee.innerHTML=marqueecontent8 r6 x- [7 ]- z$ D. }* H* t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; [* _/ m2 e* I1 d
}7 {. k0 ]8 t+ D
else if (document.layers){
4 \& U& i: P2 b% f: ens_marquee=document.ns_marquee.document.ns_marquee2" n" F7 i' O- A& U. B
ns_marquee.left=marqueewidth+8
7 ]- S+ {% ^" t8 o- N+ u& R$ lns_marquee.document.write(marqueecontent)
7 H1 x: M( K! y! [- |( W; tns_marquee.document.close()) Y- Q) n. W* J; ^, z1 Y1 `+ C
actualwidth=ns_marquee.document.width
U" j0 k" }* b9 X}
/ P1 H1 ~7 x1 _. u" y, H6 Klefttime=setInterval("scrollmarquee()",20)( v0 X) ]2 c3 ?2 ~/ [. K* z6 ?( X" `
}
: A5 c8 H) ^ i' l, e, I3 @, M5 mwindow.onload=populate
& z, q. f* ~$ V5 J9 `3 \8 B! j& C; m, r6 N( \+ v' ^
function scrollmarquee(){% O6 A/ j( W* P7 r2 d, [
if (iedom){5 s* \0 N: U1 [, h
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' A( t5 y* L+ y7 C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 G/ r' e* D% W2 Qelse7 |5 B, U0 e( C; Y% b
cross_marquee.style.left=marqueewidth+86 H, b7 e X& l+ V$ u+ t' q5 ~
- z D- _4 t; A8 f! M# k
}
' T/ U" Q# F4 belse if (document.layers){* S- O0 J+ y0 `# S5 U6 V
if (ns_marquee.left>(actualwidth*(-1)+8))
$ b9 O$ I+ H) ?+ @, j8 `ns_marquee.left-=copyspeed& X; v7 v0 A+ q D9 |6 y4 o
else
: S3 z1 V Q- o0 O7 k. B6 Rns_marquee.left=marqueewidth+8' G8 g" R! I7 W
}
9 V8 h$ o3 O6 [2 i) F6 \}
6 X9 r9 V: N* p1 L7 C
. J( w# S4 T% @% \1 J/ S. c2 iif (iedom||document.layers){6 b' U0 D! G' b; c' n
with (document){4 v& C0 p# K6 Z P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); _6 i! r3 t Q7 y q2 Y; \2 r
if (iedom){
) f) @1 t8 I# }7 d1 _: x: h' A0 u1 iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 O- V2 h1 j, s( Z5 \, a, t& q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* ]8 p8 ~2 ^4 t1 \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! t1 ?; g* G+ E4 s/ P6 P& Fwrite('</div>')
9 X7 w; D, u: T" J) D1 `}! v. h" V* o7 F2 O6 ?
else if (document.layers){
+ ?& F9 e' L" q* i4 {8 {( o6 Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( O9 w0 m3 h. T2 {4 q" O/ u# Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" X! X: L' [2 P& I. q2 h; N& Qwrite('</ilayer>')
6 J% w- m! ]$ q5 j! b}/ v1 B4 w# R: k# o3 Q: I
document.write('</td></table>')
8 v; f3 C- C7 K" V4 h8 ]; y}
+ F9 w9 S G- F7 ~9 d& ~8 V0 Z4 R}
! ]) x$ c1 W" Z3 Y; S% i5 N$ U</script> |
|