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

|
网页之跑马灯文字特效
//修改宽度
& x/ Y- o( m8 |: w' a% bvar marqueewidth=300" t8 S, Z% N( s
//高度
2 l! x" t; v* ~! M4 S; l4 Fvar marqueeheight=258 Q- u* j' a9 z0 H. y2 N* D
//速度(1-10)
! f0 M, r& B( @: a7 v5 H. U4 k! h3 evar marqueespeed=36 Z! P, n' q+ \3 u# `" \8 f
//背景颜色
4 i2 L! J" k3 @# U4 Jvar marqueebgcolor="#FFFFFF"
/ G d+ o3 }8 t6 F! j& G" \, w//是否能暂停 (0=no. 1=yes)?
# j! z( X K! c: \8 ^( ~var pauseit=1
+ P" P) X9 u& u x
. @" C0 @) @3 a: {//修改显示内容. W* x$ A0 T6 x+ M5 J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ P- U1 \0 Q E) h# }9 t$ g# l d k% A4 ?5 L0 B# ~) Y
) T# P' Z/ X; S5 R" d& _
////下面不需改变////////////
& V8 W' Z' x2 f7 m3 ]" H) S7 @( u# i- j8 `
var copyspeed=marqueespeed+ v! s2 E- g, A' {! a
var pausespeed=(pauseit==0)? copyspeed: 0& L9 C% w% T* t
var iedom=document.all||document.getElementById8 S5 F6 R7 y& A
if (iedom)
: y" n+ ]3 R) W/ k. r0 Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 S8 X: X8 A5 A6 }+ ~5 i1 i# J
var actualwidth=''6 Z4 z' f Q, ?4 N3 t; {
var cross_marquee, ns_marquee
% P5 a. b9 Y1 Z, r- T% G( D+ f3 J: I' ^, y3 g: Y
function populate(){- k$ c$ s; |( k2 ^
if (iedom){
* w$ I; }+ H( ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' p b0 A. G1 o1 K& e! ^cross_marquee.style.left=marqueewidth+8: L% K" o# i( A/ E/ Z
cross_marquee.innerHTML=marqueecontent, T) }, s+ R* Q$ t+ z. f, T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 F, A; s0 q) Q& ]+ E3 F
}+ S& \1 E; {0 r
else if (document.layers){
9 Z. h$ ], z$ J3 Lns_marquee=document.ns_marquee.document.ns_marquee2
/ G; P, Y9 O9 N. N2 S6 H* V% hns_marquee.left=marqueewidth+8
1 `1 c; z& ]6 e6 `ns_marquee.document.write(marqueecontent)
. \1 D& q& R$ U- dns_marquee.document.close()' E, O* a Q- y6 x O% q- D
actualwidth=ns_marquee.document.width; E. ^; x" N7 N6 y
}
( C. L2 X: Z+ Z3 |$ @lefttime=setInterval("scrollmarquee()",20)# R1 d% j1 R Y8 N* u
}
# g: I3 o& T, I( O! }window.onload=populate5 R# _5 \5 T" Q& z
4 u; |* f7 z! efunction scrollmarquee(){, k4 E( H9 T9 \& {
if (iedom){$ K: ?! F0 B% L, r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 B( \, s# b5 _* X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ ~4 i8 n% B) F$ M
else
/ o# _: m( m, ?4 D+ ~7 hcross_marquee.style.left=marqueewidth+88 L/ m' \3 {6 f" L1 i4 j
, Y$ A- y5 ]0 z" D$ Z
}
, E/ A& `. p" v( b* Jelse if (document.layers){/ Z$ U2 h4 d7 X. c
if (ns_marquee.left>(actualwidth*(-1)+8)); x4 T' p2 t) }2 a: @( C
ns_marquee.left-=copyspeed0 e' o$ m- U8 d& n/ ?4 X5 d4 B
else+ J9 J# d/ U( j( ]$ _& _
ns_marquee.left=marqueewidth+80 u4 B# Z2 c( _( f3 ~( E% {1 t
}& J: a) g7 R D! w* d
}' y1 ]( ^' P7 C2 @
/ R) W0 d; j$ E' T1 X! s$ R) w4 p5 A
if (iedom||document.layers){
h! N% C) q& G0 U0 @, }with (document){# B. O) g$ d4 s8 v z# ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 s' F% O$ L# p1 rif (iedom){
, q i( ^) S `0 g6 s9 v4 ]: O5 V$ fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 e9 V: Z% i3 Y9 p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 v* B: B: y; A1 e {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" N1 q- Y$ |/ }! ]- twrite('</div>')3 D( G4 D @6 w* G& N; @
}6 l' a% O4 J i2 ~% a
else if (document.layers){
0 G! {4 ?! S" fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 [, r* Y2 |5 b7 bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" P9 K8 }9 Y$ A$ ^& Y
write('</ilayer>')
- s- ~) [3 D4 E( }$ k0 x7 h}
) ?) c" |& \) V6 |- L+ u" fdocument.write('</td></table>')/ t% Z! [8 n1 |/ v/ n: J
}
* V& t/ Z8 a% P) T}% G# F; ]3 R! K* `& l# O
</script> |
|