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

|
网页之跑马灯文字特效
//修改宽度* W1 [& F7 Q) N+ R$ i
var marqueewidth=3004 _0 G# D1 W) \& [) F% p8 m
//高度3 n5 O/ N4 S9 b7 f
var marqueeheight=25' J5 r% I% w) \- W" u( @/ n
//速度(1-10)
" P5 M d: B% Z' Gvar marqueespeed=3
; n1 T+ x( c+ G4 T# u! r//背景颜色* F3 T1 S0 A% O5 N5 {
var marqueebgcolor="#FFFFFF"7 W( S- k3 r* }+ N2 Y: o
//是否能暂停 (0=no. 1=yes)?
6 h' Z! t/ P bvar pauseit=13 y' k4 [- J q1 M
+ Z( H$ V& c# }//修改显示内容
, m1 H8 v9 _3 Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ d9 R$ {2 ~/ L5 I! w0 ?
9 }" D4 r$ E9 [ |0 b ]. b$ f
/ h9 ]# M) I: r. |" ^////下面不需改变////////////
# r5 P" a2 G1 K
( ]' P5 x5 c: H* o, d2 G' O- ?var copyspeed=marqueespeed
" F4 O' a, K5 F& ]# }+ y# D6 a9 t" \' L# zvar pausespeed=(pauseit==0)? copyspeed: 0
* r$ L6 H" s' P2 U; cvar iedom=document.all||document.getElementById
6 Z( ^$ m% k# f( L5 ?if (iedom) Y# `, S( ~+ e2 C; x4 ?
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ K% w) O! Z$ ?7 `5 {
var actualwidth=''
# H" i+ \1 X2 P7 V& tvar cross_marquee, ns_marquee! U/ N$ N& m" U T {. k* b% i( }
+ m4 t2 ^- Z- N- gfunction populate(){
# b, |! C( D: cif (iedom){& T# T Y) t# K4 \. c
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- g& y1 M" U, A1 [, y0 }cross_marquee.style.left=marqueewidth+8
$ `4 j N" H5 z0 {/ A# A4 hcross_marquee.innerHTML=marqueecontent
- [. m% b/ P) ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( L4 ~; ]& ?$ i}+ W$ v4 l6 q/ L. O# `6 V
else if (document.layers){1 n$ ]/ i) v# g2 w
ns_marquee=document.ns_marquee.document.ns_marquee22 m, M6 A* W$ ^
ns_marquee.left=marqueewidth+8
f' W% U6 p4 Gns_marquee.document.write(marqueecontent), A$ V- p1 V: ^7 L! ~
ns_marquee.document.close()
# U4 {- ] K' t) G( W0 @" wactualwidth=ns_marquee.document.width
& w% K9 g/ a) e) r& U2 p% H1 g}
( ?0 U$ h4 H ?- o# j3 M1 W* Plefttime=setInterval("scrollmarquee()",20)4 G; V1 B9 e5 ~ c
}
4 @" n+ \6 N7 F/ t- E, X9 H: Xwindow.onload=populate; F. v6 [# E; Q. @3 S9 M1 A) ?
& s# l* s8 m. b
function scrollmarquee(){- ~( |5 ~- P) L
if (iedom){: C0 ?& v0 E+ s# i1 q8 k+ V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! d1 o2 a+ V- F/ qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! l) A; N- C5 D1 q. X" ^
else5 }9 y6 @9 T8 ~2 ]+ }# {6 `. F2 G
cross_marquee.style.left=marqueewidth+8* d& Z% o+ F Q4 o0 ~! y
0 ?% m, @9 {& {}! [: y5 a- P; P& h; T ^
else if (document.layers){
/ r; `; c. L) h# _if (ns_marquee.left>(actualwidth*(-1)+8))( |* p$ p7 D7 f9 R/ Z8 ?
ns_marquee.left-=copyspeed
% Q/ G& {1 y& U# W1 Q& Ielse
j2 Q1 n/ N& R: S3 ens_marquee.left=marqueewidth+8$ a: X( H, ~7 e* [' a
}
. L R0 y: R7 @+ `: @3 S' A}# _4 x1 M( m4 C7 V
H$ @9 B1 j; O2 a& U
if (iedom||document.layers){7 q! Q* i: ?( z2 @) W
with (document){! n W% B J3 P' F- W2 l+ D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 C9 U, A# u: }" G% n: |if (iedom){
1 H- L% U& A/ } Q+ c/ swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- i( T3 i( e& F2 z9 y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') s# D9 a+ q% O. J( e [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 g: O3 t! O( E5 d4 t; H. D
write('</div>')
. ?* _- {7 E8 Z- L; W}$ H& B9 I9 t+ G% I7 w% F3 Z
else if (document.layers){2 A5 b; J7 v! Y' O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 J( z7 x) P! l5 `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, f/ f; W9 }5 E3 n# p9 a) Vwrite('</ilayer>')
' o: F. U$ a; N( M}+ n1 I- \4 R# f B9 V1 u
document.write('</td></table>'); s' M3 O# C( b# h- ~1 P
}! ?& V% X V* L! G
}
+ I- B( h6 `7 l9 M</script> |
|