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

|
网页之跑马灯文字特效
//修改宽度# M, r/ e0 Z' o. i+ s2 _
var marqueewidth=300
: }8 ~) c! b; z: w# O' J( {//高度
3 U) ^4 L4 h1 T8 J$ _: Avar marqueeheight=25
# H* ^, _# {0 g" C; _) T3 U//速度(1-10)2 k* s1 z8 H+ ]& D/ w5 i5 m: d: p( Q8 W
var marqueespeed=3: \0 D6 c" B% _9 C* ?1 l2 R4 g
//背景颜色# G6 \+ Q3 @ F/ {) A; ]- u u
var marqueebgcolor="#FFFFFF"+ R3 W9 n+ _( V$ X: j4 w' D3 I
//是否能暂停 (0=no. 1=yes)?
( s; I7 q( f* ]! G) ]. f. i/ Rvar pauseit=1& p3 x7 I+ q1 b# a
- e; e8 D% A ]/ O J/ b
//修改显示内容! U. G# e ?% Z, l& A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ m6 t/ _ `- r/ A2 G4 m$ M
$ X& D2 T2 _: L- C8 O* N2 H" n$ E. H( b& k( y0 b
////下面不需改变////////////- m3 K& T. P9 U6 e) P: u
8 k! S2 _0 ?4 j
var copyspeed=marqueespeed
' L& s% y& t% G) H* g# Fvar pausespeed=(pauseit==0)? copyspeed: 0
$ e, A8 x( f/ q2 U/ {& G" \var iedom=document.all||document.getElementById
8 r7 O9 H3 o6 e: Mif (iedom)
# O/ `2 t2 d/ v9 ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& q% F. f6 A+ ? l* w
var actualwidth=''2 p, P4 v% F! w! c" ?7 z
var cross_marquee, ns_marquee- w G0 ?; o) l) M: h# u
1 K3 z" H7 _* c$ X2 m4 P+ ~# H
function populate(){9 Q' ?) D+ d0 X% a/ k6 o
if (iedom){7 c/ t1 I W8 h' a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 v( _# y% o7 \6 l% F% I* rcross_marquee.style.left=marqueewidth+8
7 G9 P* w+ L- r: a# ?% [cross_marquee.innerHTML=marqueecontent
. H& i# V9 `* Q3 Y) P. Z8 _+ s. i8 Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) z" t6 L* i3 N2 Z7 d8 Q( x
}
% q8 G8 I5 [- f" r$ D( Nelse if (document.layers){9 x3 e9 S4 h- V# @1 c: t |
ns_marquee=document.ns_marquee.document.ns_marquee2
# M/ E% G$ j+ |$ j2 c5 ~( `ns_marquee.left=marqueewidth+8
/ k4 V* G7 l" f& p" I5 A( g, e; \/ Vns_marquee.document.write(marqueecontent)9 I8 f( _1 E5 V
ns_marquee.document.close()* N, Z+ b3 M h- {" d
actualwidth=ns_marquee.document.width
, Q( C. o9 l" a- l}- k3 o; N$ C* C" D% L# b
lefttime=setInterval("scrollmarquee()",20)3 x2 \1 U2 U1 B
}9 l G$ k U; w. E9 ~# o
window.onload=populate! C( H5 N) U2 G! ^! b1 U
3 P/ C2 A c& `. s6 _! w7 cfunction scrollmarquee(){3 w" L! v8 A. O) v' Q
if (iedom){; _4 Q9 z @; z/ w2 ^: L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' ~1 P. [9 n$ O' N+ x7 p6 Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 I6 G) U( i( o' I% b, j
else; U+ _4 l# h& a5 s$ s/ l) w
cross_marquee.style.left=marqueewidth+83 ^3 j) g. V, J ` E8 p
# G& u' }* c# z) `+ Z% R2 x/ M
}9 @5 T" ^) p. b+ M: k
else if (document.layers){3 n1 r& T% ^( L
if (ns_marquee.left>(actualwidth*(-1)+8)), y! o! V7 l& U4 H* k& ? ?
ns_marquee.left-=copyspeed. l* d# ?8 p2 d/ q8 b( z
else& Q4 a3 O, H e4 m5 \
ns_marquee.left=marqueewidth+8 x3 \' m$ k3 g$ P
}
0 ?% t: v0 N6 K( ~& o: r# r; Y7 j# B}
* U" K9 y6 r# h8 U! y( [9 I) s; h' V$ o# q7 x* H) x
if (iedom||document.layers){& a+ f ]2 u# @1 }$ H+ Y0 T# N1 M
with (document){+ T, B! O3 B/ k4 i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ D( [5 M- ?% j* k
if (iedom){
" M* _, U$ n9 K, D# N, d. s2 w8 m: fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 S! ]; N& r% f x+ l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) m, F. _0 Z6 v- }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 A( S4 U( v2 ~7 V
write('</div>')
( C2 r3 o5 X; @$ G/ J5 N} x6 s) h! u# y4 h: z
else if (document.layers){# y* p% d o! L1 Q- J* K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- d9 y% _+ A/ Q1 t8 a. R6 s2 G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 ~/ }3 H& O, Q9 c; Q
write('</ilayer>')
| H( a: B6 }7 u' X}
0 l# g6 o G1 a! |) ~1 |document.write('</td></table>')
4 z7 I, y2 {6 w& b( G _}3 @5 l, ?4 P: R4 @2 ~- `9 q1 u
}/ N7 T" u6 `0 H# H5 ^9 z7 v
</script> |
|