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

|
网页之跑马灯文字特效
//修改宽度
8 ]( I+ c0 N$ v2 m, ?var marqueewidth=300
Q0 a3 k$ ?8 g9 [; y3 N2 p7 [. d//高度8 c& Z* D3 M9 H( D( Z
var marqueeheight=25
. i' n# M; ^+ [0 B4 q6 h2 x' r//速度(1-10)
( e% Z- |6 r( @, F" }var marqueespeed=3
. C% q7 w4 T, L' J n. X- T9 U//背景颜色 |! C0 K1 ?% ?
var marqueebgcolor="#FFFFFF"
5 f* B' h1 N6 [, S( L. Y) z" x//是否能暂停 (0=no. 1=yes)?5 _% R6 N- E3 j4 d
var pauseit=15 i( @( I* L8 _" t, A
0 Y6 l7 Q( `1 o$ n5 S& ~0 C) w0 v
//修改显示内容
( z6 j( G" J. T' D9 F+ [4 N: qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 f k" h5 e/ ~/ Z2 k5 i, G
5 h$ m( v0 G5 m: s1 ?, v
5 O" f% U# h" X' P/ D( a" w////下面不需改变////////////5 H, w7 @; [6 U- J0 m
& Z7 F. l m# [% F% ivar copyspeed=marqueespeed
5 v2 V+ W3 G$ Ovar pausespeed=(pauseit==0)? copyspeed: 06 O3 B3 E5 O7 U' I' h4 {' t. N
var iedom=document.all||document.getElementById- C, s# u7 w: |
if (iedom)# I4 ~+ v% {+ |1 @% ^) E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 a0 I7 q+ A' X: w7 e+ `: o. Fvar actualwidth=''
2 ] B$ l5 r: z* lvar cross_marquee, ns_marquee
6 D" D7 w4 Z1 d, q' Z
' O! v3 ]6 Z2 R; e, J9 ~, Qfunction populate(){) b- C F9 `& ~# q5 ]/ v H9 i" R
if (iedom){
' T% F$ H2 \7 h6 dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. A$ t. ^3 o4 V$ A. c2 }: L
cross_marquee.style.left=marqueewidth+8& @$ l5 M' `) U* b7 i
cross_marquee.innerHTML=marqueecontent) R$ e+ z: C4 I2 U3 {* ?4 T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& ~" e5 s6 t8 ]# [! D! P7 E- Q% O0 ]}
3 K2 S* p8 _$ R* t0 Y+ gelse if (document.layers){' q1 [) y: I5 L: T C- K
ns_marquee=document.ns_marquee.document.ns_marquee2
$ m* r! n" O( N! A V$ p) Uns_marquee.left=marqueewidth+8$ f# f# [1 p& W @1 |
ns_marquee.document.write(marqueecontent)/ `, d9 Y7 Y0 [/ G |
ns_marquee.document.close()
( y+ M \% x) M; Aactualwidth=ns_marquee.document.width
1 h7 X: K7 X4 s+ ?6 k, ?# X8 i: X8 k% b}
1 V \; q7 }$ N1 J& H" f& {lefttime=setInterval("scrollmarquee()",20)
& r. B& p8 J! n. [3 K7 G U3 O& D( l}
0 V% ?5 E/ w; lwindow.onload=populate3 \ o: r5 k) j5 n9 Q# L( r ^
@5 R+ N- R: l" Y8 |8 v. P \
function scrollmarquee(){
# Y6 k2 h/ e3 I6 lif (iedom){
1 q$ R, m2 y ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& C+ U1 [2 n0 b* [. Icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! j( S! j$ A, Delse
) d4 m% D& L3 g2 n9 Xcross_marquee.style.left=marqueewidth+8
3 r/ T5 {) u+ R2 o; @% x1 z {: ~! a" f1 S8 f* }
}
2 Z2 B! U' `5 S1 [else if (document.layers){
0 M0 N7 i d' N$ i: P b# Eif (ns_marquee.left>(actualwidth*(-1)+8))$ u- ?3 w- t, L4 d
ns_marquee.left-=copyspeed
7 t) e/ a, u$ {; Velse) m3 Q- r; H; p) l/ H
ns_marquee.left=marqueewidth+8 D( e; M, l0 {+ H1 ~4 {
}
5 I+ W0 M! D9 n3 \; F' I" N/ [}# N1 W2 g7 q. ?% o" J4 p8 l
* S/ C7 i! T* |& T; V' A' v4 q- p
if (iedom||document.layers){) f7 T8 x- ?4 h" t- h \/ m2 B
with (document){
7 l# `% S, E1 h+ r& D' rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* N$ T. U+ I6 {& V# @
if (iedom){8 p' q9 c, c, v& X. ^: O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' ^+ |. ^: B/ zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 Q6 J8 o* i$ K4 l/ M$ C T' j' M% }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 K- M6 k# r6 g- M# Ewrite('</div>'), \1 D r8 g9 v
}! }% ]. P0 }. }* z) a
else if (document.layers){$ M! X/ Q9 X' ]6 ?0 q5 N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( w# k5 Y/ k( y8 Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 _% y% w X/ S
write('</ilayer>')+ @) G5 f8 @7 D. q! x7 h/ w% l
}
* ]* g7 y2 I, [# Y0 B: @4 z8 [2 y; ydocument.write('</td></table>')' e- P" B& l% f3 _# g& E
}* @0 E- p9 N9 L: C* f( h* I
}# d8 z s7 t1 n1 T5 t3 h
</script> |
|