返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 N8 {7 Z" s1 A8 f3 n2 ]. M
var marqueewidth=300
" A3 q' l' B- w* G# u1 t! F! v//高度5 r1 o; T" }- A" r- U3 ~
var marqueeheight=25
3 S3 N8 @; y& d% A) L8 w  g3 A//速度(1-10)% W5 P( b  f$ ~9 M) l1 G8 k8 E
var marqueespeed=32 p0 z4 _) J) R4 w' H
//背景颜色
/ `; u$ W7 Z( K, U% T$ G* G' yvar marqueebgcolor="#FFFFFF"
4 ^, J7 [; y/ X( G//是否能暂停 (0=no. 1=yes)?7 h  g8 X# ~6 k
var pauseit=1
& _, |0 d: G$ b$ i" b. B4 D) T/ ^6 t
, [+ r" O: @6 |5 H  ~/ M1 T5 |//修改显示内容
- l! R7 A" Z: ?/ z2 K/ U) c1 ~6 e* Lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ Q/ y7 h4 J( X
( [1 s- B  T& |3 T

  Q# p, S% k. M////下面不需改变////////////
. O/ \  k/ v* f4 B1 n+ [
7 I7 ?! W# E( b* J! nvar copyspeed=marqueespeed
$ {' w+ w$ u8 x. H9 C- a9 Qvar pausespeed=(pauseit==0)? copyspeed: 0
! A6 p8 _& y" e6 e' j* w; Z/ x7 mvar iedom=document.all||document.getElementById+ O1 g0 T" V1 P. d- Q
if (iedom)
+ [, I/ Z4 F+ G  A9 @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 S, I- E  F$ U3 I2 M- k0 E
var actualwidth=''
3 V0 l$ |) A6 r/ L; ~' `0 _! k, Xvar cross_marquee, ns_marquee
1 V# `9 s2 G8 i, }8 ?9 c6 l
/ m6 K( s) {( I; B' S7 w" F& Ufunction populate(){4 m1 V. ^5 B9 M9 q" W7 I: g
if (iedom){
- R, H7 s) N. d  Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& u) [/ A' e& R1 b8 u$ Q) f1 R, D
cross_marquee.style.left=marqueewidth+80 S9 ]7 o, [  H' T
cross_marquee.innerHTML=marqueecontent
- E/ N! {# M: E6 H( Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 \: J- J7 p! I2 i! i}0 y5 q  U7 z$ o# V$ e* d3 t- f$ ^
else if (document.layers){
3 D8 s0 @2 \8 s; E+ Ons_marquee=document.ns_marquee.document.ns_marquee2
: u: O3 E) |3 uns_marquee.left=marqueewidth+8
1 x5 b) U8 a, f' b  Hns_marquee.document.write(marqueecontent)
8 z. S7 V6 b! H: b, ons_marquee.document.close()
$ e0 i# z8 Z6 Mactualwidth=ns_marquee.document.width; }9 l' I% r, Y) q& l% E, Y
}
7 ^% i  s- `. Flefttime=setInterval("scrollmarquee()",20)( x9 s0 m7 {: p1 ~; d+ e
}, U3 g! ~; i. s0 ]' |* j3 r" }: n: V
window.onload=populate
( _0 t% m" X; c; S1 b$ u2 S( r- s" f! p3 k( O
function scrollmarquee(){: \& g1 w$ l- O( x! S( t2 O
if (iedom){
! U; @* s+ b, R. L% L1 F$ H4 Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 _- A0 X: q8 j5 L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 ]. ?9 N3 I. \: m4 }$ Pelse
% U. Y% ?  F9 f7 Q- l- Lcross_marquee.style.left=marqueewidth+8
" D( r3 c* K3 Q! e! q! n
& M* S; @' S' |- Q* h& L}' Q' K3 n5 G* x. w6 T* z
else if (document.layers){' o% z% ^! f5 M$ W# z. e7 x
if (ns_marquee.left>(actualwidth*(-1)+8))4 X+ R) d- E! [9 }8 C
ns_marquee.left-=copyspeed
% u2 t0 Y. Q/ b5 celse8 P% F9 M6 V0 Y6 k7 ]( j, b/ J- k
ns_marquee.left=marqueewidth+87 E5 q  A$ H7 a0 t; F# L) n
}) D. H0 H/ Q" w& D
}2 J2 E9 P0 N7 K8 H7 F

% u  b5 j$ r* Y, tif (iedom||document.layers){
" n/ Q7 _, j. Twith (document){; a; A: O. J: S, f" X) ^8 f) ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ Q7 H, S2 v; e9 Cif (iedom){
7 o5 G( T3 }) e5 R# L2 Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 I6 W% y& T* S. Y6 t" X* P  g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 d( J" X' U, _! F) Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): ?" x8 a# X+ s1 x4 N( b9 O# n
write('</div>')" p. x2 f( r5 x% m2 I
}) k9 P1 o7 ]! X! J) `) w2 [, p7 n
else if (document.layers){! b8 t6 Y* Y+ O; U4 _+ ^
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- @, u" l/ J+ S/ M7 @5 b) ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 X  {* Z5 W/ a8 Swrite('</ilayer>')  F* `; T+ O  m4 |- {7 R" h& p, \/ k  |7 O. H
}6 g) a7 N4 ]) P7 ~- x- \) z
document.write('</td></table>')4 ?4 E; R9 y2 y) [
}
: U& b  Z' w' J& X+ z+ K}0 O! ^' y6 S: z" M5 u6 T- P
</script>

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