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

|
网页之跑马灯文字特效
//修改宽度
2 M: u% d+ D5 c8 R6 i9 L) U6 Wvar marqueewidth=300
, i+ ]5 u: t0 P5 M6 w# _//高度
2 M- u; O1 [/ ovar marqueeheight=25: a" \1 X/ |) f2 j2 Z, F7 E
//速度(1-10)8 {/ p; `* V' e. l# U' j
var marqueespeed=3
! K# x; ?' n/ \2 [0 R//背景颜色
. _' r% ~' v$ Q/ d$ @ T1 w& n uvar marqueebgcolor="#FFFFFF"( m; @% s, \( F7 a) O' s r
//是否能暂停 (0=no. 1=yes)?
2 @ c5 m( x# u' r( w+ y* cvar pauseit=13 Z8 d; G" ~& \' ]
, V, Q8 [+ y9 q4 j# F# T" B7 B/ j" z//修改显示内容- k5 c; Y/ S0 G3 j4 F& u0 ~2 z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) I# B) i0 `% ~0 m+ l" C8 p
: d2 |3 i1 Z2 W& J
2 h& b* ]; H/ ?' ]7 e6 S////下面不需改变////////////2 t* V5 i- F( h" w/ Q) T
; R; o0 P ]5 d% mvar copyspeed=marqueespeed
& s, j: a7 x. f% |; G$ M' avar pausespeed=(pauseit==0)? copyspeed: 0/ v6 J8 |' M/ Q+ n- ?/ `. h
var iedom=document.all||document.getElementById
h+ r8 B$ `7 J7 T+ p# N9 }if (iedom)# m2 A, G3 ?; Y( S% q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 ~% U$ X; x p# Q Kvar actualwidth=''! \/ b- z# G% H% I5 j( O
var cross_marquee, ns_marquee- m1 m3 m9 Y; r. v8 `3 x
0 s* P8 R) `+ D6 Cfunction populate(){
* M# a" a9 d% D& E5 X8 Q3 fif (iedom){
6 g" [( p' P( `9 Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 P7 m3 P, H9 G) z
cross_marquee.style.left=marqueewidth+8' Y, w' F$ p* `* p; M3 j
cross_marquee.innerHTML=marqueecontent% \& I/ A6 \) j: }: i& t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' s% O1 j* }: i! \/ ^}; K0 v, ]. ?/ m X5 c
else if (document.layers){( ^8 E5 d' ~9 w$ H) S. a
ns_marquee=document.ns_marquee.document.ns_marquee2
3 \$ Y, t( J+ k% t& ens_marquee.left=marqueewidth+8, ~+ w( a" Q+ O$ j+ A) J. Y
ns_marquee.document.write(marqueecontent)
9 Q7 V0 N4 G6 ~ns_marquee.document.close() L4 G, M! e/ v, k& l+ E6 f
actualwidth=ns_marquee.document.width% D4 C1 a2 M; L: O# ]
}
2 O, t3 N" G8 q( K9 \7 d+ B Q& zlefttime=setInterval("scrollmarquee()",20)1 m8 _' x4 h4 s! i
}: h M9 q U2 q
window.onload=populate
( u" t, {- [1 d) X, H
, m' L+ l" K! y# o n8 O. rfunction scrollmarquee(){* w0 w( n' S& d9 H/ D
if (iedom){& w8 {8 @% ~/ a: P+ e( c! ?* s
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) _ @* n6 U3 T3 I8 {/ U7 H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 ^0 ]8 P0 L1 b3 U! X) Z
else
5 D5 k. J3 W+ W4 t0 lcross_marquee.style.left=marqueewidth+8# X j& X; F7 q
8 D1 u& @! z- G0 I& c' @( Z
}
5 n& A- F8 j" D' `3 Selse if (document.layers){
: ]( j: X& T. s- p) v4 Uif (ns_marquee.left>(actualwidth*(-1)+8))$ s' ^ s8 @& K! J4 m8 G, e1 F
ns_marquee.left-=copyspeed" a! n) U! E- ]0 m h% w
else" U$ L+ f! q+ T* y0 x# D1 r$ Q
ns_marquee.left=marqueewidth+8
( L, g9 }" W0 p, f1 x}
) `8 m( J1 \% b; [* B8 u}! U) O: k% `' H' c' X
4 |+ J" m |8 U! A3 z0 K/ ^# {% v" e
if (iedom||document.layers){
' w+ [, R- r% I- I, U) j% fwith (document){. h. g7 P) I7 l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, C. T) x4 k [3 p+ y0 z3 `if (iedom){$ q: h& e. u3 ?/ Q. ^. s
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 ^* _6 C$ r! w/ F9 \. h7 G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! a) H4 u! S1 z9 f0 p$ _6 Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ g$ R% k$ d6 j: D% `' Hwrite('</div>')
- r( `+ H/ q. @5 D3 A- z+ S' T}- r$ B. t! D& x- r4 j& \
else if (document.layers){9 k+ N Z; l- F4 S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) }: V8 s4 _; u% K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
p) J, F4 ~8 Z+ d. wwrite('</ilayer>')# V7 _4 {6 R0 X9 l. n# h
}
) Z/ D/ p) i4 W/ ?" qdocument.write('</td></table>')
0 G8 S, C4 L$ z( b7 |}
$ \" m# C2 F! W$ I}9 u+ E6 `8 K# o
</script> |
|