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

|
网页之跑马灯文字特效
//修改宽度0 j' L3 _. u# z4 N8 @. Y
var marqueewidth=300
% \: [) O8 S- a4 ]! Z//高度! u3 x" D: g3 y- h: [: s
var marqueeheight=25
) Q4 S7 }/ u6 {4 B$ T- a//速度(1-10)
6 U: b9 c$ r; y ]) @var marqueespeed=3" i* k, ]6 p* L1 @1 q
//背景颜色" |) k* K' U; |* ~% c& i" X- j8 V
var marqueebgcolor="#FFFFFF"( C3 A4 D5 Q% C. W" c/ D4 o
//是否能暂停 (0=no. 1=yes)?( ~" D& E" r# O+ z: h0 _' w
var pauseit=1; o' }2 E' C3 Z+ G
+ ^- k- ~1 Z( x& r& R2 J: f" ^//修改显示内容
( d# T8 _1 Z% w5 Svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# G# g# p# t0 _$ v" p
1 Z( i7 D& y: |/ c2 w+ V7 u; x* e
( O% u, i8 |0 P7 X$ K' Z: j////下面不需改变////////////- p4 J- E) M5 {1 `; l
# i3 B) ~0 @ @* H% v g
var copyspeed=marqueespeed3 ~) ^- H0 r5 U* S! \: N4 U
var pausespeed=(pauseit==0)? copyspeed: 0
: {- b; e# W2 O' V1 O) w k6 J4 Mvar iedom=document.all||document.getElementById1 X J7 W0 F- s4 ?2 ?, @
if (iedom)
6 a5 w( p/ P( J% z& p- ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), I R( T+ w+ s) @" A+ c$ d2 L3 y
var actualwidth=''5 E! C1 p. g6 L! f1 n6 J9 T# J
var cross_marquee, ns_marquee/ D% j2 b# Y2 ?/ n
6 H- x+ y# ] M ~, p; @function populate(){
1 q" z5 y" j% X* ]if (iedom){2 }! x: \3 D5 h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ j( t# m# S& g" `# N' Tcross_marquee.style.left=marqueewidth+8; ]/ {: o- c) C+ j8 p
cross_marquee.innerHTML=marqueecontent0 M: S, M4 y! T, \1 d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 K4 d$ ~. |2 v( E
}
3 v' ]$ B/ e4 f- D+ h' y* w+ ]else if (document.layers){
f; Z! M+ f( J3 U7 o# [ns_marquee=document.ns_marquee.document.ns_marquee25 V3 z4 y0 A6 `; N9 b* n
ns_marquee.left=marqueewidth+8
# M/ |% i4 `) pns_marquee.document.write(marqueecontent)1 x4 U" a+ n0 ?; C( A
ns_marquee.document.close()
! @) p( X3 L- [7 l5 i$ ~' vactualwidth=ns_marquee.document.width
3 F* F' K, `% ~; r- k}1 S; k7 r; ^, l
lefttime=setInterval("scrollmarquee()",20)
D' q; l( P, Y: v! n}# y# W L3 K3 U5 a# n
window.onload=populate
g9 Z7 A, O6 H9 i5 u$ |, [, i6 G+ s- w
function scrollmarquee(){
0 z2 j. n" O9 Wif (iedom){
% Z8 b0 v7 P. { C1 oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 b' c2 A- s/ b6 Z2 z# B6 ~! d% S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 I" b7 K9 B5 e, d
else
5 }. O' ?9 F0 H# D9 }4 |cross_marquee.style.left=marqueewidth+8
( z8 D" t9 V p. ~) l% b
( ?4 p$ S4 e) t}+ I& x3 N! k, s* U' L7 P
else if (document.layers){2 E5 ]$ q# M0 g; d1 w
if (ns_marquee.left>(actualwidth*(-1)+8))4 y- v a, l u- }6 x8 l* ^/ i
ns_marquee.left-=copyspeed$ {3 G9 ]. r6 V$ u# j7 f9 Q
else
+ L5 O2 x% w0 `+ o* ^1 t/ T7 t: Uns_marquee.left=marqueewidth+86 q8 U( P+ H/ k/ m$ ]
}
# m; y+ T( i( y: B}1 d( d# D2 j q) G
$ k7 ~+ b1 L, g% Oif (iedom||document.layers){
% \8 m8 R( Y& j$ x3 Nwith (document){
) }/ V1 i2 B6 s; c; [+ ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ l) g+ e/ q2 E* N" o* o
if (iedom){; c6 g5 @9 _' [1 M6 U7 v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), c2 J$ \% A3 k4 ^3 l$ n( z0 J7 t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 s, G' p. e4 v% ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 \6 x- J9 ~1 ^+ X9 x3 Y- Bwrite('</div>')
2 s% Q/ R" n7 ~" m" V0 u}
& u# _2 P% W# a/ L5 }2 Uelse if (document.layers){$ m% g& b) C) ]$ H; x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, v' k# |, ?- s4 z7 x: Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: H) z* B, E V( {9 m8 V& f5 awrite('</ilayer>')! _& c) D3 s5 a! ^0 {- G# }
}9 M) k4 Z0 j; V. p# b
document.write('</td></table>')3 I3 K5 B1 m. @# l& U
}
% p. E* \7 S( s. L1 ^}
! }/ P. h/ S) X( `) d7 ^( l</script> |
|