返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 I5 U1 J: c0 K8 R9 H5 wvar marqueewidth=300# s; V) d- g5 H; @$ e; p
//高度
% C  w  P7 g. O7 V/ F! y6 B/ Svar marqueeheight=25; a% O$ c6 Q- V* J
//速度(1-10)
9 u( J7 x% T, j$ T3 ~- b' ^! G' xvar marqueespeed=3
" A$ R: Y# z1 |! I% R5 _' N+ Z4 n//背景颜色8 t( J7 E; l& _1 {, F- Z
var marqueebgcolor="#FFFFFF"/ a, F( n  L. P" t' f
//是否能暂停 (0=no. 1=yes)?( p1 T) d; X# B) P
var pauseit=1) ]  f5 ?# z2 m! s" X6 V% O
# Y* v7 w! f9 h2 C3 ~( E
//修改显示内容3 B, a7 E! ~, R  j8 s$ W2 N$ x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 b% x, {" d' X) h

% V. n7 x% A& @8 `6 q. T
4 i4 A' Z! a5 V! N3 f/ M# k) F0 g////下面不需改变////////////# N, V5 \4 ~' w2 }" l1 [" A
4 l3 u' E: Y" n, A
var copyspeed=marqueespeed% x! @4 o) A. n6 j4 o
var pausespeed=(pauseit==0)? copyspeed: 0
6 V8 K8 T1 o) ~$ s4 ?5 wvar iedom=document.all||document.getElementById/ F8 C2 w* c9 W3 Q
if (iedom)
- D, g# k) [. X, h0 j- ~7 ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) H, L- P- g: @2 e# q6 g5 Gvar actualwidth=''
$ |: \3 O4 r! ^2 L/ {var cross_marquee, ns_marquee
; C7 [8 y9 E( Y7 g$ E8 Y7 y7 e5 `: z2 ~+ z$ M  {  C, g
function populate(){/ G& u; S) q+ U  Y+ B0 x) i9 r) ]
if (iedom){4 E3 H4 z$ [4 i: e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ q7 K0 H. o4 icross_marquee.style.left=marqueewidth+8) M3 X3 ]& V! K1 @, f$ U7 M
cross_marquee.innerHTML=marqueecontent
% e" w3 @" {# {. U1 E* Oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& `" ]: G4 T$ }: ~) `  v
}6 {- o7 }) I6 ~- s" j
else if (document.layers){9 o2 I( m! w$ D$ Q9 I
ns_marquee=document.ns_marquee.document.ns_marquee2  t% |2 d1 i% W+ ]; |: n
ns_marquee.left=marqueewidth+8
; S3 L0 Q' t* n% g6 U1 o! Fns_marquee.document.write(marqueecontent)! c1 A( A+ ?7 K+ {7 K
ns_marquee.document.close()
- m, k; V4 s6 ~; J; b4 @! Factualwidth=ns_marquee.document.width, `; {6 q; ]! A% _! n! k1 |
}0 m) F% _6 M. ~& X  ~, N( V
lefttime=setInterval("scrollmarquee()",20)4 _6 e" ~& q6 f: t  @, X3 U
}
- z- p6 @7 q) p5 m3 e9 C! iwindow.onload=populate
/ n( x" H& |" `( w& H) f7 }- z+ i* c% Y, `2 f; m
function scrollmarquee(){+ C2 H* `6 x- g
if (iedom){: G& S, ~1 y% n6 i) F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 j* G" S7 E7 d1 T, }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) H8 n9 m+ w" d# f8 V
else
: f* l4 Q% ^+ Ucross_marquee.style.left=marqueewidth+8
9 D* B3 o! @1 m9 @( j
5 L2 l1 \" i" A! h& ^}
/ P; y' k" M" H$ f$ x4 ~/ L& ^; B  w* belse if (document.layers){: u& ?& r* O" A7 e5 L
if (ns_marquee.left>(actualwidth*(-1)+8))8 |& w& H/ ?8 n; Z0 @- Z
ns_marquee.left-=copyspeed
/ ~6 E' m' S5 f# r" t6 celse
  r- [% n; J( c! o$ O+ Kns_marquee.left=marqueewidth+83 U+ p: d* n2 \
}: a  f/ d% u  T+ `4 m
}$ N# {: X  B0 s9 `9 s
3 G8 v5 b/ N& R! @3 o& I
if (iedom||document.layers){
, H$ \: E3 J" z& ^5 I7 C1 hwith (document){* a9 a/ \: ~+ R  Q- F, D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# \  j, l4 s( _1 W  `
if (iedom){% x) Z8 G- R$ \. k1 q/ N1 a0 s4 A
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ R0 p$ B: t# i0 b" |! l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 w6 U6 g0 V! J  D9 L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ R7 j" G0 h( ]9 R) Iwrite('</div>')
6 b8 A& V% m' N2 x! q% u}
5 g; G. M, X( T5 m; gelse if (document.layers){
% A7 m* H/ ?% F/ V1 e5 qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' e( W4 a' d; p" w. \0 Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) }1 H/ m% _4 ~+ e& g& pwrite('</ilayer>')
* F. l: _6 w& `- m: s. A}
- x" x% N7 F* R3 b2 ^' W8 Odocument.write('</td></table>')
; K( V% k1 V( l8 B$ c- D: o( C* y% o}& {, s, ^) n$ |
}
7 w& e) S4 _3 p; N</script>

返回列表
【捌玖网络】已经运行: