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

|
网页之跑马灯文字特效
//修改宽度
" L# L+ z; o/ L* ]$ Hvar marqueewidth=3004 F- F. s+ O; C0 s; P" v
//高度
2 m( O v' D9 `) j0 [var marqueeheight=258 F H* g5 U: G4 r
//速度(1-10)
# B. w8 I; o! m0 O1 C8 [, M$ `- gvar marqueespeed=36 s2 s* Y! a9 O, t
//背景颜色5 m3 ]) @9 m1 M
var marqueebgcolor="#FFFFFF", F, B/ u, e: s r3 X9 i9 M* n
//是否能暂停 (0=no. 1=yes)?0 ^. u! N# W+ h& T8 u5 s, s, E
var pauseit=1) ~ E5 j; i9 c9 g' D6 C& f
2 v$ a" s* R8 p6 r/ T4 U; t//修改显示内容3 d1 m$ x9 |+ Q/ K$ V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; c0 U" n( G% m4 I' r' ]( B! y" _' D& I5 C- R4 a
$ ^2 N+ @% z. B
////下面不需改变////////////$ b8 J- ~# }. ?+ E! h2 @1 g, D2 G
1 a* M4 R, C# P& A8 _
var copyspeed=marqueespeed: d) s" A! ?0 k" M
var pausespeed=(pauseit==0)? copyspeed: 0! W8 Q. `( X: A2 @4 H" B6 O6 ^6 g
var iedom=document.all||document.getElementById
3 b" Z: [2 I$ C3 w# N! h( C. d5 mif (iedom)" F9 @" }7 [4 a) V, ?2 d$ ^; ]3 m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' r7 e0 {& }- x3 Yvar actualwidth='', [/ Z, k) { q! j' U+ x
var cross_marquee, ns_marquee
# {; |+ z, D7 i, o6 S& r9 v; o/ r8 z* @& e1 S8 l: b
function populate(){' i& d" N$ s. {" Z9 y
if (iedom){
6 O3 j* i G3 k, tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# D8 f! g* @# Z2 V. u1 bcross_marquee.style.left=marqueewidth+8' j. {! y. t0 N; ?8 f" f/ w
cross_marquee.innerHTML=marqueecontent2 Y; m5 ? B3 O2 Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" a# G$ @6 _3 ^
}# s6 D n+ ?1 W. v
else if (document.layers){
6 P3 [7 B0 @: E( u- }( W* w5 X, R# |& Vns_marquee=document.ns_marquee.document.ns_marquee2+ j z; j P& J
ns_marquee.left=marqueewidth+8
a* o# l3 H% D* h2 [! @( ~ns_marquee.document.write(marqueecontent)
! Q" f7 _) E$ M! Q0 N# Y0 Ins_marquee.document.close() d) L/ c1 Q$ I# y9 O) ^, I
actualwidth=ns_marquee.document.width c3 ~# p. M. j, h
}# }7 ?0 V6 e/ ?, ~- O5 d+ G
lefttime=setInterval("scrollmarquee()",20)4 u8 {5 v& `* |" f1 z
}
9 g, H2 E' j5 N3 n+ j$ l) bwindow.onload=populate( Y% `! x: Q. n6 V* r# W
# g' n \) c8 O( Q/ l
function scrollmarquee(){* h5 i- p7 T- j
if (iedom){
; E3 E W% V B. G* f9 l5 W8 zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ L) q( ~" r7 A/ L; D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- { g; C B; n
else
, K8 \/ B- m4 i% qcross_marquee.style.left=marqueewidth+8
+ q3 f! W. o, S7 ~- C
/ _, _, n+ h; H+ v) C! w/ D1 R}2 J7 G/ r& W) f+ n4 N/ a0 P
else if (document.layers){
: ], g/ p9 Y% f: b9 y B: K, Y! _- Uif (ns_marquee.left>(actualwidth*(-1)+8))6 X4 O- r6 n& |" i2 g. {3 n; T
ns_marquee.left-=copyspeed2 N) l* e/ X" m Z8 r2 T5 U
else) d6 }+ M. B2 ~( t' f
ns_marquee.left=marqueewidth+8/ U, d2 w) G: K- D4 ?
}3 a7 W' h9 u" V' b
}% `: i2 W; {' B0 ~8 I+ D
% J( g; _' V+ U: {! i
if (iedom||document.layers){4 y8 I t9 e1 Y- S8 T- \$ P
with (document){
- Q2 J7 S! W" E/ p1 Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
t( d9 }4 r( I" A1 o ]* Pif (iedom){
# b6 F: f, Q- u, r# J3 @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% o- f# c6 p2 s* z% e3 N3 zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 D5 ~. }; j! k$ k7 [% Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 h! l l5 ~2 i Mwrite('</div>')" P. k' `7 k$ m& Z
}
$ a# p0 [" r2 |7 M7 a1 b% P7 Oelse if (document.layers){
1 i# u8 r8 v) \ i* L" j0 @8 {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- ]. b! k( s. {- u1 h Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% d6 V" J* w: D/ H3 h3 h
write('</ilayer>')0 \& \* Y0 Q- v; D
}2 D, @2 F" z. X
document.write('</td></table>'): v! A5 ~3 \5 z4 g
}7 k) t' u3 |' J4 z. [ m
}& \- d8 B0 \& f+ d( O5 F2 O
</script> |
|