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

|
网页之跑马灯文字特效
//修改宽度
, H1 D1 ]3 P" g$ e; V) P+ {var marqueewidth=3002 e& C8 ]/ l$ s3 ]0 q
//高度 U$ W3 Q: N" z7 S
var marqueeheight=254 W" E2 c2 _4 ?/ {1 \
//速度(1-10)- Q L) k: c: i6 l2 I6 X& f7 @- d
var marqueespeed=33 Q# d5 q9 C3 a6 R1 G* Q
//背景颜色
+ L- b y1 C+ C7 m! kvar marqueebgcolor="#FFFFFF"& [0 B' c' b6 w5 G3 j
//是否能暂停 (0=no. 1=yes)?9 ?3 I2 s0 {* r# r8 u: _
var pauseit=1: P: [: n W! q y7 s! X9 E
0 z U9 F2 d, h/ O: E) u//修改显示内容# T8 O1 [! a( @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 s M, p0 Z @ ?) i) R5 `4 y" T; O. H5 D) S: b, \
( h6 Q4 R7 ^) B0 z/ k9 H////下面不需改变////////////
% k: N: Z1 I- d' Z" J& j1 ]! [, N
5 q9 W$ k1 i5 o5 Svar copyspeed=marqueespeed
( u7 n( N3 b: ~, n/ v; Vvar pausespeed=(pauseit==0)? copyspeed: 0! p( s$ [1 R' _4 h
var iedom=document.all||document.getElementById# z$ @- z2 M! x
if (iedom)/ o$ [" M- B% x6 [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- t+ }# A. O" M6 `var actualwidth=''
9 w4 J. ?0 {" Q9 l* w6 s. uvar cross_marquee, ns_marquee
) V$ e" V) n! R2 {$ S" Q9 b' f. b3 q. N. S' @- M2 B. J: @* _) l# z: l
function populate(){* }7 R0 [; K2 \1 c. i7 { ]; a( c
if (iedom){
) ]- G0 G- x6 _) ], ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& E8 v3 ?. {& a3 |cross_marquee.style.left=marqueewidth+8: x1 a9 ?" l" m( d: ?, b
cross_marquee.innerHTML=marqueecontent# ]7 @0 w2 m2 ]% `. j0 ?6 {! C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' o5 X. `4 e( a: A/ F( X, }4 J+ N
}
6 H2 h6 j* G L5 ?" melse if (document.layers){$ b* n# Q8 }9 {- v& R& v$ A; v
ns_marquee=document.ns_marquee.document.ns_marquee2
0 H" ^+ V6 Y7 A% Cns_marquee.left=marqueewidth+8
% C V) C% r! f1 Z! x7 Qns_marquee.document.write(marqueecontent): h4 t: ^: \' a% N
ns_marquee.document.close()
3 o$ w4 {9 B6 o) e- ?* Bactualwidth=ns_marquee.document.width
8 W& O+ Y( c" _}& j, r( e9 Z( ^( L i- c
lefttime=setInterval("scrollmarquee()",20)
) v6 R; b( [" G7 H}
( j! ]) S; r& ~5 a, awindow.onload=populate
1 ?+ M7 L* F, g3 [. w- s3 \: L* p4 Y2 p* m! b
function scrollmarquee(){ W1 o$ T3 A2 K) B+ Q& n! R
if (iedom){. c6 z5 l$ ?% g* Q/ [( }& M
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ O( h' B0 \* P: \( S F& ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 b$ Z$ }0 g3 L" Y$ V" P
else1 o& B' P0 A7 a- O
cross_marquee.style.left=marqueewidth+8
9 c* l3 v& s9 S7 o5 S: s' [! x; }, \; x* y" p' {. L5 l* E4 e* J
}0 Y% j' O' M1 X& o" m# ^1 k
else if (document.layers){7 A; m8 N- X* S
if (ns_marquee.left>(actualwidth*(-1)+8))( ?* J+ M/ h* E* Q9 D) ?6 C; M
ns_marquee.left-=copyspeed( t, j0 a$ m, m7 ]4 M. b2 u& s
else B! L% \. [( t% k5 G6 T
ns_marquee.left=marqueewidth+85 C4 e' a' Y' I# H
}
' } N2 T, e& R+ o) _& U O4 G}
0 A8 O" _' m1 W/ \( S) ?+ ]9 J8 R. H1 d6 n( _" S; p! A' C* H$ V8 c- t! A
if (iedom||document.layers){
/ x, [: S! O& c$ F6 ~with (document){8 l3 r, l! h$ x
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& `, o0 ?9 @7 A% yif (iedom){4 @( U- Q. {: y, p% ~3 s
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 @ W1 k6 a. x: \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 {2 T1 H- q( D; T: i7 ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 z7 b( P" @4 n3 n$ ~
write('</div>')
) k. z! ? T3 ~: K v& b9 y}( H7 Z. N. g, Z& x3 ?
else if (document.layers){/ K: o8 R Q+ R; R; O: z. w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' J* M* o5 B5 Y! X6 l" ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ ~6 p* @. o# ~+ ?- V6 Z) t, G
write('</ilayer>')8 w* V$ Z: R9 Z
}
9 _+ u3 Q: V) @& R# u odocument.write('</td></table>')4 b9 U' C2 N, \5 o3 U* d
}
8 x- Q1 I% {5 p}
* X- n' W* A; n; V' f" c% a</script> |
|