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

|
网页之跑马灯文字特效
//修改宽度
7 M# a# X! l+ p) T4 Jvar marqueewidth=300, `+ o K* k ]' M& M# T& J
//高度
# j9 S* @2 P8 N' D8 Yvar marqueeheight=25
( l! k9 F. L8 x: n3 V//速度(1-10)
$ b# {; P: V) q# _2 ^% Yvar marqueespeed=3
" T/ w4 t3 i8 t0 G) T9 u0 j//背景颜色
) a8 J( T+ t4 p, d" U3 O9 }9 [& bvar marqueebgcolor="#FFFFFF"5 P' C' V5 V- k3 R
//是否能暂停 (0=no. 1=yes)?1 S5 f2 T4 ~0 |! r/ C1 V7 v; E& g6 G
var pauseit=1
( m, P/ C: u- h/ v& W$ S+ _% t5 s
//修改显示内容
) y# c% {+ [. K2 i" m J; t- W" tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 F; o) h* m2 c& D+ U; e
4 o( U& H% Z1 Z4 I9 O
5 w5 ~% Y& a: B$ |2 I) G////下面不需改变////////////: K$ q- x; \/ u& b0 n2 Z+ B
8 X5 ]) ~( Q& I1 Vvar copyspeed=marqueespeed, _6 f# [3 r, u; b
var pausespeed=(pauseit==0)? copyspeed: 03 t# d: T4 d6 [. J8 x; N, k
var iedom=document.all||document.getElementById+ |0 Z0 P$ u! N
if (iedom)
! c- r0 \6 ~2 {. pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ v$ D6 {" W) n+ |( f- x4 Avar actualwidth=''' O. o3 a6 _0 m' H$ X
var cross_marquee, ns_marquee" _1 O! f' y: h5 Q" ]7 C& i
: S( C! |: A- d$ m$ g3 w( |
function populate(){; i6 }# L+ ]+ Q2 D7 `
if (iedom){
, A/ s9 Q* o6 r. B# g3 mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 }5 u+ X; A m ~/ I0 v. Q2 S' r
cross_marquee.style.left=marqueewidth+8
: y$ V- P: O) {* Lcross_marquee.innerHTML=marqueecontent" t7 A- }' C9 Y8 i: l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth ]% E0 q( J1 H) `( j1 I
}0 w+ ^0 x( k8 J2 Q7 V
else if (document.layers){' ?& E/ w/ _ k0 W Q. T$ j
ns_marquee=document.ns_marquee.document.ns_marquee24 B0 @# ?& g6 o0 r
ns_marquee.left=marqueewidth+8
1 {3 P, A/ A6 @7 U' Q2 ~ns_marquee.document.write(marqueecontent)
3 h* @/ d f y7 F+ O8 c/ R* zns_marquee.document.close()& ?% h) ?$ R* A( [+ i; f9 T: l
actualwidth=ns_marquee.document.width
! D7 E0 ~1 b1 C+ ~# Z1 X! P}! o2 e U" L$ h3 G# H
lefttime=setInterval("scrollmarquee()",20)( U7 F8 s8 [! x" f
}
! p" ^% d1 D0 n6 jwindow.onload=populate1 G" B3 ^9 H8 e' R$ b
1 q; L8 a/ a, r
function scrollmarquee(){/ G2 R* _) z( p9 }2 ^
if (iedom){
2 g0 [ }7 q- b8 R6 `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" Y! W0 l6 n2 V8 q* R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 I3 H- d; D4 y1 f' u5 lelse
$ [8 I% X' g; f% X% w( Rcross_marquee.style.left=marqueewidth+8, S; d* V) F; w# P
2 D, c2 n" Q8 _. G6 i
}
, J3 g' j" u: qelse if (document.layers){
9 o8 Y: f9 m; F) J% k# u/ ?9 [if (ns_marquee.left>(actualwidth*(-1)+8))2 t6 d3 W1 A' Q- k7 J5 ~
ns_marquee.left-=copyspeed# [2 B# B( G# {" S1 C1 I7 ?
else
* a m7 Y0 g4 j2 g% nns_marquee.left=marqueewidth+88 h! x; {4 o: ?- f& T
}
* Y6 K% \2 k/ W4 p9 k- S}
$ q. C4 E0 B0 r R: O; J; P. P
9 U5 z% L R/ D: K; Vif (iedom||document.layers){0 V" |2 I! {# g% ~/ T' i: ~
with (document){
7 e6 [/ }7 t4 |3 _. R: ~ _" t$ F ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" n4 Y, d, t+ `7 n8 R1 D% U
if (iedom){
: Q! N7 c3 h) [+ @2 f. Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 ]4 l1 N: J* m8 |0 Q5 }, g1 D( N1 {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- X+ i* y& a, S) l6 a$ E9 o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 u- n' z1 B# q9 \6 a8 w7 x
write('</div>')
8 [, r. m, K! a/ v6 J}
: ~) h$ j/ J5 }# |else if (document.layers){
3 r3 t! d @# E7 Y: Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 O5 v4 Y2 I' X9 Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# \2 I0 Y' G8 P1 L: e# Twrite('</ilayer>')( c0 U0 M% s7 V8 H
}- _3 ^* i; i$ r* y4 N
document.write('</td></table>')
& S" O: Y0 \+ ]1 J: K) v}
, s Y1 y6 R. Q. V- n}! G4 o- H7 V9 ~
</script> |
|