返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 U2 V, L, D; u& C+ Z9 B5 fvar marqueewidth=300
+ j; l/ y6 i* S//高度
! z1 ~( M1 m0 w0 D4 O9 J/ \6 Fvar marqueeheight=25
2 R* Q/ x2 r+ b# v//速度(1-10)$ ^( j) t- S3 v5 G" N
var marqueespeed=36 j, Y) [( _% b2 S1 L2 t- ?& `5 h
//背景颜色
" {/ B% g& m8 e# ^var marqueebgcolor="#FFFFFF"
# l' R6 [9 @& a( f" ]//是否能暂停 (0=no. 1=yes)?# D, N% G' t6 z" m& s4 L5 ^: j  z
var pauseit=1
$ W- @9 }% m8 d" y, I3 ^3 g( w+ I
, e# `5 R- j7 G//修改显示内容
3 I5 @: K! {! O0 R: wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; E+ i* @9 O' u, C/ P/ G' d0 B1 `( R" c5 }

3 ]- B1 z/ u! t1 v' l8 V////下面不需改变////////////7 [" I7 {; `2 P# Q  {- T/ k/ v& z/ I+ U
! X/ ]- Q% Q/ d( J
var copyspeed=marqueespeed
( i* k3 }3 P- {var pausespeed=(pauseit==0)? copyspeed: 0
+ A: j- D: ?$ T# _5 g. {7 l; Avar iedom=document.all||document.getElementById; N* V( E2 N( A( D+ V" [) h/ e9 C
if (iedom)
# f+ L8 u. x) M: Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  M3 p" k8 |' H4 d1 H1 R& ]" u+ i
var actualwidth=''/ @8 b8 u* k8 Y8 A) Y- J, L
var cross_marquee, ns_marquee" F1 F& K' u( N1 y2 O3 ~) ~
+ y6 H3 @) }2 J# \* W
function populate(){0 s# n, l5 M" ~
if (iedom){5 U5 t9 T& I* d! y- K2 B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ [6 g/ ]- {  G" [0 a+ T- `2 c$ w
cross_marquee.style.left=marqueewidth+8& [. z9 C# c7 g/ y3 e$ c
cross_marquee.innerHTML=marqueecontent
( U6 }. u- F+ r! Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% [8 G+ f% `- {' z$ S
}9 P0 I* \9 v, B
else if (document.layers){! `4 y6 f- Q% r- U$ J: P3 O1 L" g
ns_marquee=document.ns_marquee.document.ns_marquee2
0 g: i2 ]+ ?0 x* T  Y( F; l- `ns_marquee.left=marqueewidth+8# k  N% ?( y; U6 I
ns_marquee.document.write(marqueecontent)
5 ~: e% j+ x: g9 Pns_marquee.document.close(). m3 x6 e$ p7 E/ w& z" ]% z8 O/ I
actualwidth=ns_marquee.document.width
  m  v0 {. y0 d$ Z, q+ [}  t  J2 H4 e( |  B- C
lefttime=setInterval("scrollmarquee()",20)$ W; K7 r0 O" L( G
}
) n% e) f2 s6 ^# ^+ Ewindow.onload=populate; b4 G. q; Z& R4 }; S3 b: M

$ j! P8 E: R8 J6 m1 vfunction scrollmarquee(){
6 }) g$ E$ P1 V# d+ qif (iedom){
; j+ I3 c* d/ bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. o# o0 t5 ^3 o. }, ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% W# T; k, Z: i4 f8 qelse
% ^. P. P# {$ Q- F  T+ {4 mcross_marquee.style.left=marqueewidth+87 ?8 v4 J+ e# U5 K7 e+ f. k
( X" L( X! w& n4 L& x  v" Q
}" M$ E- b( [1 E' I- M* y8 r
else if (document.layers){, ~. q& k/ I7 A9 e& r
if (ns_marquee.left>(actualwidth*(-1)+8))
( [: I9 O- N! V; {' V0 ins_marquee.left-=copyspeed
; `- E5 B. q& j1 Helse0 r6 ~7 c: H7 s5 W: K* I
ns_marquee.left=marqueewidth+8, a' [4 J$ ?: Q
}
5 v  H% e& D  W- y# y+ t}% V- H$ i9 E, A8 D- \. U

3 n5 ~6 M& n+ |  Jif (iedom||document.layers){: l8 W0 z" d7 P% z5 }/ |6 J
with (document){
" T1 v4 M. n- W0 f8 W+ Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); O) u2 G0 q  C  D" i+ h, b  \9 X/ ~
if (iedom){/ b' W" Z9 G# N6 a8 D- ~: p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% i0 i- N  s1 A. ^. J7 @9 h, pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 r  m9 i$ M0 f0 N  p6 Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ ]/ ~" f7 m; T& ^! B7 [6 q4 z
write('</div>')
+ ]; ]5 Q5 z8 A6 _9 E2 m}+ u* j8 h1 U6 M
else if (document.layers){% j& @7 l& R  i  k5 T
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 W) ~5 c+ G" r# p. N9 W6 R; k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) p* H. g( {) j1 C
write('</ilayer>')
8 K2 N, \) u2 ?9 n}4 c+ Y" a' b/ C
document.write('</td></table>')/ u, v8 q" J1 K+ M+ j
}9 M! [1 j9 |6 Q$ C8 O* ^
}
* ^1 [5 X" ]/ D6 T6 z</script>

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