返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 b- \3 x1 d7 d- xvar marqueewidth=300( U4 q% m6 R3 I- Y! p
//高度
3 w2 Y  @0 P) A8 [; I) x+ B% g0 Fvar marqueeheight=252 q+ ]( M* Y* w2 G
//速度(1-10)1 p7 ~2 {9 b/ ~! S" L' y9 h% W
var marqueespeed=3
' e  ^0 j' B6 b8 Q0 B//背景颜色+ ^( Y1 A* s0 L/ n1 k! T+ t# ?* M
var marqueebgcolor="#FFFFFF"
9 @6 r3 h9 d; m//是否能暂停 (0=no. 1=yes)?3 g  d1 p3 K; u1 z: |
var pauseit=1+ E! e; R; e) L- c3 W" m4 P: {

) v' I3 O3 S5 c* @' A//修改显示内容  z6 M: g' X* H5 P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* o* g$ X5 t/ g# q1 ^

# B6 w  C5 b2 E
1 G: Z: x4 w5 G/ Y+ d////下面不需改变////////////
0 x7 q  m" c7 w) k5 C# M
1 O8 V6 o) d( p+ X9 G* i& jvar copyspeed=marqueespeed
4 m6 x4 s% P/ K' z3 gvar pausespeed=(pauseit==0)? copyspeed: 0
8 a; j. Y/ u# a$ I; A1 Bvar iedom=document.all||document.getElementById
+ M3 E) G8 N  Z" S3 uif (iedom): e. W  [& r( n  d. u
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) Q( X; N/ I5 Jvar actualwidth=''0 I1 B. @9 i; q) e  g8 h
var cross_marquee, ns_marquee9 m4 Z5 @. ]6 ^' m

+ c. C- t; O( {5 R% a4 u) ifunction populate(){. |; x- k8 D/ ?" Q0 B4 a" s
if (iedom){$ {! O  ^3 P+ Y+ l; a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ ^7 t) b; f# P! A' Q2 M# R
cross_marquee.style.left=marqueewidth+8; M; l$ B9 B/ m) y; N: W
cross_marquee.innerHTML=marqueecontent
, M; B6 n6 I: X  \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( S' C4 K! d' ^# g
}
4 L% A/ x, h3 A0 [% Eelse if (document.layers){
1 t- z, z# ~0 Y# A3 e* \  Cns_marquee=document.ns_marquee.document.ns_marquee2
: f& f5 n- {) ~ns_marquee.left=marqueewidth+8
5 K/ ~( v7 u+ Tns_marquee.document.write(marqueecontent)
& |* R! x- E, a: R, K4 \. z9 qns_marquee.document.close()
$ z2 O9 Y3 P, c+ N1 eactualwidth=ns_marquee.document.width( X8 a- [* n. }8 H+ C
}) ^8 ~0 s4 L5 C
lefttime=setInterval("scrollmarquee()",20)
; Q- J6 s+ C1 ^2 X$ T( h" x}; i  m  t( K" U" h
window.onload=populate' G6 F' }- f3 q: R, p, S
0 M3 u! j- W3 r
function scrollmarquee(){
' T6 V0 J% Y4 j; I7 a8 G! Kif (iedom){$ v5 E9 V) B' \( {5 b8 I" W% i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* k& @+ \. q: t3 a; }( m  h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ I+ z! y, F- ?. v. y, E, Q$ e
else
- @% q. i4 Y  `, w. p- w8 hcross_marquee.style.left=marqueewidth+8
1 {1 Y: W, s2 w+ w% f+ E0 [( Y; s$ |; {
}
4 ?2 o2 X7 w4 [& F, y# ]5 l2 D) c7 lelse if (document.layers){- s* R2 A4 Q# ^1 h
if (ns_marquee.left>(actualwidth*(-1)+8)); [! ~; n5 e; d! N. n& V4 z" I
ns_marquee.left-=copyspeed
! H3 t- s: e) u4 n, W7 n3 |9 `else+ t1 l. V8 I' R. F+ t& s0 f  m
ns_marquee.left=marqueewidth+82 v1 w2 K5 a0 c! Y, D
}
. r" u1 G0 i$ p: T$ u0 w}( ?! Y2 f6 y8 q. d2 [7 d+ ^
! M4 }6 J' x# b) E& B$ p: F" L
if (iedom||document.layers){
0 s2 U5 u  u  K  M( Q% z: o% Hwith (document){0 E8 }5 m3 f% I/ j% ?. h) r$ |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 k$ M5 Q5 x0 ^, v/ ?if (iedom){6 i& [, r6 k* K; y( f/ G% w
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# V3 x1 K# l5 n$ C6 p  T6 g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 a4 W# I$ \* t2 W- L* X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  ]- X, \5 i+ G8 U6 W: Rwrite('</div>')& ^; x- I: l* p1 b+ H; T( M
}
8 C  ~1 i% o6 K; C* Jelse if (document.layers){
# F0 q8 f3 y/ l( T5 O$ u' gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 J$ Q* n6 j2 x. v: R- E' A6 Bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( t7 e6 \$ B) h' f$ X/ A9 E
write('</ilayer>')$ ~6 C2 Z0 \; i8 o
}
6 e8 J5 g% T, [# _/ P% Ddocument.write('</td></table>')( R/ L& ?7 i% W
}1 o- a7 P5 ], ]. h8 G' e
}
! |; D$ Y/ ^, Z2 w</script>

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