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

|
网页之跑马灯文字特效
//修改宽度
) O. t6 S" A+ ]var marqueewidth=300
8 n6 r2 u; E( E+ W( U" I4 w//高度0 _4 s' F' E8 m
var marqueeheight=25& t) Y* }, E% O$ j
//速度(1-10)( _0 g0 r$ L+ ~8 p) w' U
var marqueespeed=3
0 \ K% I6 @# ]# h' _//背景颜色
- c. L$ p% j6 n8 _3 |- evar marqueebgcolor="#FFFFFF"0 Z) Y$ Q% P+ C3 _4 P5 o1 @& g% b0 k+ B
//是否能暂停 (0=no. 1=yes)?% d9 s' y! `! P$ c
var pauseit=1
9 c2 [; o' p; M( v: j
. d8 p% a- X( g+ q- H5 F ]//修改显示内容+ m4 F& i8 c3 z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ S/ C1 h, `5 C1 w( J( Q
' k' K/ Z5 V8 | }$ v" f4 }% U6 a- F$ N5 s/ ^( P. p( D+ X
////下面不需改变////////////4 U" g# D A5 h7 g
* k2 K$ Z( e5 j8 t2 y; s6 E$ V3 v
var copyspeed=marqueespeed
: B; U# S, l- a( ~, \var pausespeed=(pauseit==0)? copyspeed: 0
4 Q. h A! r. a" ]var iedom=document.all||document.getElementById7 y6 F: W4 S# `5 Q9 ~9 A) q! p
if (iedom)
8 Z- i: E& d) H) D! t K$ @/ z; ?: i' U E/ Bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ h& a; D" c$ w. @5 A5 i/ G8 }1 U
var actualwidth=''
) T' Z4 F9 a, m- L4 u# D! Dvar cross_marquee, ns_marquee. w' T& p, X/ O5 I- x) J
$ d! I) ^$ C/ k8 N6 J
function populate(){
4 C4 n% V5 e/ d+ w {1 `! b. H: jif (iedom){
9 d6 |- i3 W1 J: T( ~- u' kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- z3 d& f; v$ i" b
cross_marquee.style.left=marqueewidth+8
# z! o& f0 j c K' U2 Qcross_marquee.innerHTML=marqueecontent1 w' w8 s; B1 N. k7 T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ ^! X, H) e4 B& M) T}, h& l6 A: B2 |
else if (document.layers){+ d6 a" B3 M9 Q' U
ns_marquee=document.ns_marquee.document.ns_marquee2
3 E; Y% ?) Y A9 Z0 D# bns_marquee.left=marqueewidth+8
5 f% V$ k7 ?4 i# H; ~ns_marquee.document.write(marqueecontent)( S2 \' b9 ~7 `4 [( [+ M
ns_marquee.document.close()
$ e z( u3 l3 ? m5 ?+ W+ zactualwidth=ns_marquee.document.width
2 y* U& ?6 G- r/ l$ [}
: H: i f+ z. R4 slefttime=setInterval("scrollmarquee()",20)+ n0 R& N- ~+ X# a+ Y9 ~% U. O
}, W* d% b: t; l% V% I" t5 r- l
window.onload=populate% l( U; r) D& p K. C
- ^1 N% ?5 T: {function scrollmarquee(){* M: z4 |7 {0 ?- F) i( P
if (iedom){
- b# a5 h. n- m4 A. Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ T5 t- T& u7 H _! l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* s& a' P- h5 ^8 w
else
I) ^$ D# J' U" h) Wcross_marquee.style.left=marqueewidth+8
- M0 V2 V1 c# U9 o' ~8 q+ e
2 D8 T M+ x" m8 V% S} f0 A/ e7 g; t& D3 T! W
else if (document.layers){" |& ]! X# ?2 x
if (ns_marquee.left>(actualwidth*(-1)+8))
' e4 W( N1 N; t- q2 s7 U7 ^ns_marquee.left-=copyspeed4 j* F5 }% x7 L; S6 P& i3 D& s
else& q1 h, H( a2 Z4 ?
ns_marquee.left=marqueewidth+8# V9 S0 |. z1 u# h8 g. S1 X, R
}: R$ s; I1 B8 n( ^
}
8 d' j$ S6 P8 X, D& G7 p
! e; s9 q1 d# d7 ~! o% O) J/ fif (iedom||document.layers){
; U7 Z7 g- T$ b5 Qwith (document){$ w; z( x1 f" @& ~6 m( L5 X+ M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 h* p! @$ `" M \4 w+ h( G. cif (iedom){
* y7 t4 m0 u$ a5 Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
}. [9 R8 M" xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 J8 f1 E# c2 r7 S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 E J$ ^1 O) F5 ]1 rwrite('</div>') |4 A& V5 \( {" M: x! S
}
; F) D& X: {! `9 a; G4 c" a, telse if (document.layers){/ l3 _, X; b' C* J* J& [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. }7 U* `( g1 F8 a, B5 u0 Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 C! b. X8 a1 {8 w: [write('</ilayer>')
% k% P3 h; ?. r$ w0 A/ ]}
* w9 E! M3 T0 E4 E0 Qdocument.write('</td></table>')
* [; D L! g# _: t7 X}
: T$ }: n% G& w2 {4 j}; l5 F4 |- u& \$ @0 I& `
</script> |
|