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

|
网页之跑马灯文字特效
//修改宽度0 i, E8 w9 L4 S% p4 [# ?+ `' p
var marqueewidth=300
# L* v6 T9 H5 h% ?//高度
9 ^: Y& J, N# c$ @: Mvar marqueeheight=25
; E2 }0 U# u0 f5 c//速度(1-10), r) \, @- t. o# w a
var marqueespeed=3/ J( G( c# h" `) q, ?9 v! E3 g
//背景颜色
* P( T9 b6 j5 n+ m2 @var marqueebgcolor="#FFFFFF"+ R5 e2 ?) ~3 N: B
//是否能暂停 (0=no. 1=yes)?1 Y, V+ g; U1 ~( A) n. `8 Z
var pauseit=1
% R, f9 N/ r+ l. W7 L9 x& | a4 ]
' L& W0 g4 y. w9 Y3 |: a//修改显示内容+ ]( y% S/ d/ D6 W( W& c0 R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- \" ~3 {4 ?, r2 x# N! t# w
" H0 c0 D9 B9 s2 m1 F9 |
~7 ~3 ~# O5 W5 K////下面不需改变////////////8 y: r- D* e, c7 b1 M* U
' K0 D$ d: q, o" E
var copyspeed=marqueespeed$ p" L7 B& K( B3 ?' K( M
var pausespeed=(pauseit==0)? copyspeed: 0* n l/ \% `( o5 e: z; y
var iedom=document.all||document.getElementById
9 C! _, `: N: c8 bif (iedom)
2 O6 T6 X3 v0 X% Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 j+ e6 A! r. y2 C; I; ivar actualwidth=''
" c7 B. M1 e" O/ e. l$ Fvar cross_marquee, ns_marquee0 j$ O2 d( P* w9 B7 R* z6 T
4 P+ [+ ~& n2 e( L) d
function populate(){
1 T& |% [2 D; }$ O5 M: o2 Dif (iedom){
, r2 U' X+ }$ Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. u) i B z; o4 Ocross_marquee.style.left=marqueewidth+8% r( I; N7 z! n
cross_marquee.innerHTML=marqueecontent% m ?* M( ?7 S* n J; i! I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; n A* a: K2 {0 ?3 r}) ]4 V9 v6 s. E0 _5 E
else if (document.layers){- B/ B5 B+ j) N9 N
ns_marquee=document.ns_marquee.document.ns_marquee2
- i' r3 y% l4 R% j/ c8 S: dns_marquee.left=marqueewidth+8
) L/ Y% I2 z8 c" ens_marquee.document.write(marqueecontent)
) i+ K, A9 E# }3 hns_marquee.document.close()0 k) `# a9 H5 s3 B/ `
actualwidth=ns_marquee.document.width3 _9 y8 U8 a" x8 v5 V( i) G
}
) U/ i5 @5 h. N9 Y& g' b% Elefttime=setInterval("scrollmarquee()",20)2 U H. ?0 z# w' i
}
/ R& m( i& q3 T! L2 q2 U5 kwindow.onload=populate
# d+ |- p2 t( W; x y( E
7 A/ y2 t6 n' p9 C4 O: V5 Kfunction scrollmarquee(){' Z( f+ b0 a6 z1 p. l" j0 |
if (iedom){
H' w: O/ k& k: n/ F+ f( q. _; }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ x( [+ D% O0 @" {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* C+ y( b) R$ e9 b- c5 m
else
2 v/ }9 Z; E, ^% K, j) {) T5 b: m7 icross_marquee.style.left=marqueewidth+8
9 b7 ~. H2 L0 |+ D0 {+ v
- P9 n' y x* S, _( c}9 k9 A) e' S7 H; i- g0 z, G
else if (document.layers){
5 [+ [8 S- }& _5 yif (ns_marquee.left>(actualwidth*(-1)+8))
+ j+ B9 N! p: u1 L( F$ Cns_marquee.left-=copyspeed
) R+ _! V2 F$ lelse6 D8 J9 u. O+ w0 @; P s
ns_marquee.left=marqueewidth+81 D/ P2 f; {! ?: c) Q# _. X
}: \; Y" y1 Q7 m& j0 v+ O
}
" `4 _8 T( B4 ?0 @, _% }3 s5 D' J0 C- F6 X
if (iedom||document.layers){
+ v ]1 T6 i5 R ^with (document){
. c: ~& Z- G4 r+ `' vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. ~. B1 `1 N% V0 ^! kif (iedom){
/ w! j# W+ r$ h; C5 s) ~ Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( |& V. V0 D" s% q7 Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ `& b% I. u4 `4 L* y3 awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 k2 t& l! @+ Y, A; u( t
write('</div>')
$ b9 n9 a$ Y+ U: ?5 d- v; R- V4 Z}
% |0 ?- D9 U% M" l. m* u3 `9 n$ c& oelse if (document.layers){: u6 |( {/ @% t: b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" M& I- `; t/ Y8 K- iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): @- l# F6 D9 m4 ?5 J
write('</ilayer>')
: e K$ s) P. f' [# q1 y# j. R}
( A1 @% \2 W) O* X, G4 A% }% wdocument.write('</td></table>')
! k& T% Q- ?4 R}
( C) D: b [! Z9 p- M}
2 v, s2 X8 m1 s. Q7 g</script> |
|