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

|
网页之跑马灯文字特效
//修改宽度
" t+ T0 C r e. F/ E* w) B( Pvar marqueewidth=300. s* ?+ g# m1 }) h. R: l
//高度3 t- o* m4 @! |. K5 C1 O0 M
var marqueeheight=259 R) g" ^4 d6 i% D, m% k7 r6 A% m1 C
//速度(1-10)' y% S: p! ~4 E& I- X! f
var marqueespeed=3: R9 k8 P' |; I! k; t+ s3 q
//背景颜色
) H" g; n( U! G: y5 gvar marqueebgcolor="#FFFFFF". O9 B+ j( J' J" l( f
//是否能暂停 (0=no. 1=yes)?
$ P( x4 p& s) J p* Y) rvar pauseit=1: [9 [# X3 u1 r+ M
B+ h# _3 G/ A9 ]3 A/ S( R( y
//修改显示内容( p3 d5 T l+ F+ Y4 B3 T
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 x# }" C# u: C7 E# r1 {
, A) Z& ?7 d! n) g) }! w& E2 x% `, p2 g. b: X- g
////下面不需改变////////////5 P4 ?9 G" E" N( } k! u+ i
1 P" V; C8 m/ D( ?. Rvar copyspeed=marqueespeed0 A9 {7 t0 m3 v$ X& E# Y& t- k
var pausespeed=(pauseit==0)? copyspeed: 0
4 p* m- o- z3 Z$ m% s, d( X$ N5 hvar iedom=document.all||document.getElementById8 w/ x# ?0 Q3 o1 p: Q
if (iedom); K2 y" x+ Z( ^0 I1 A9 Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# Y f" D/ M# H; A1 y4 c' R5 Wvar actualwidth=''
Q9 l) K- K# W/ j3 u& wvar cross_marquee, ns_marquee h, ]7 E. I" L3 l' t i
1 w0 C& A% f! b4 ]- R
function populate(){3 }. M% x" v- C# t7 \
if (iedom){7 f$ y- M% ?/ L }! D3 t9 v
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; W, e; ?5 n, ?# y6 |, K8 I
cross_marquee.style.left=marqueewidth+8# V+ |, q5 c# j& D% m
cross_marquee.innerHTML=marqueecontent
2 C0 s2 F6 j& K& H: lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' S( i6 b, K9 ^: v}
2 B( ^# I' }, F* r9 Oelse if (document.layers){
* Q, a @7 e$ j# B3 L3 a) Hns_marquee=document.ns_marquee.document.ns_marquee2% ]/ u2 K$ Q6 |8 ]% G/ B A
ns_marquee.left=marqueewidth+8
% a1 P: f$ r0 @4 ^" }$ lns_marquee.document.write(marqueecontent)
2 @( }! [/ l. z3 ?5 A6 {# H$ qns_marquee.document.close()9 A8 K; m) x6 E) [" Y* m4 _; ]5 D" G
actualwidth=ns_marquee.document.width6 Z( e: ~3 s6 g- `# n# e) R& D" w
}' L$ e( N0 W9 k& M, z. d# J
lefttime=setInterval("scrollmarquee()",20)) v# S1 E9 q: w$ N; i
}
" E9 y4 B. m: ]2 t* c# `/ q; q# B: owindow.onload=populate
. z1 Q8 A/ c! R% n4 u2 C1 ?3 v8 N4 @4 F
function scrollmarquee(){2 y" a& o2 a$ D9 y9 M0 f
if (iedom){$ Q7 |+ m- v7 [4 e3 {3 U- Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ k N+ _! d5 R1 B5 G* g- @4 Y1 R. g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ M. c; _6 X; C" Q8 N- `else2 b' w5 v9 V% _2 c8 f' T$ |1 p/ u
cross_marquee.style.left=marqueewidth+8
9 F) L0 k! ?* u7 D: j, r! M0 |$ X' s+ b* i
}- ~6 C) j% _( @3 @& e1 D& i
else if (document.layers){
. A% }: B! X' W+ p% xif (ns_marquee.left>(actualwidth*(-1)+8))
* A) T2 S0 F# k8 Wns_marquee.left-=copyspeed
: [& k" ?; N Pelse
" S. w. z4 n3 \& Q; ?8 P, [) sns_marquee.left=marqueewidth+8$ S; c/ }. K# v. x/ x
}; I9 \3 _9 O5 q$ v, k
}
6 ~# f' p6 m" x% S) J" Q0 S. z0 P# _7 q- L8 A1 U6 z: T+ z
if (iedom||document.layers){
, r# o7 W# o1 D: Hwith (document){
. V, M6 P$ Q- M0 W1 t, Odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 f4 t# [; _5 }3 m6 v2 n
if (iedom){* X9 _6 U+ C& v2 j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 |( E/ M- p2 J' |& s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 T; E' d; z% ?2 x3 `5 V pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" v2 g0 W. z7 jwrite('</div>')
; C) v6 Z) {: t% s' M/ L; a}5 z# z) G8 ]4 i# n2 B3 e: U
else if (document.layers){7 q" j3 [' m9 y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& o9 L1 @7 D1 H1 c6 x: z3 N3 a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ g. c3 c6 O) |+ {. {1 kwrite('</ilayer>')5 X. a$ H* K5 F
}4 n, D) @$ n# Z5 ~$ p0 l6 u
document.write('</td></table>')+ C. b% B% p9 v+ F y- x
}" W/ ?! d% `" Y J7 v5 ]; O' B8 u
}
1 b1 s8 |8 V; `5 F</script> |
|