返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ V; z7 T) f, a: A- l
var marqueewidth=300
* D" Q/ Z/ o. M3 j; ^8 f% f//高度
1 [7 T( I" Y( ]3 h( \var marqueeheight=25- t/ N* c" v# p/ ~+ @% y
//速度(1-10)
( R% k6 K  p/ u6 d/ @  Cvar marqueespeed=3* ~7 i. k) ^# W! }
//背景颜色( J! }  r: ^2 Z; e. C  O( f* D* _
var marqueebgcolor="#FFFFFF"  ]1 K: R3 K5 |* X; q+ T
//是否能暂停 (0=no. 1=yes)?) X9 A6 @- w4 U5 {* m
var pauseit=1# q7 R8 O( G6 J4 B7 S) n
" Z; G! L+ v# z+ _
//修改显示内容$ d- ]5 I+ a. L; x( f6 s2 `
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 ^4 t! v  o7 g4 j9 l: G/ r
! ]; E. _" I3 Q0 n: E! x. N: _$ c' f7 T7 z
////下面不需改变////////////
$ _2 J( ~% B) j0 F" v5 }+ U! t8 y
1 q2 n$ ~0 r1 ]* w0 v  P9 }1 pvar copyspeed=marqueespeed% l( @! S% p( n: q/ q+ Z" u* c, j
var pausespeed=(pauseit==0)? copyspeed: 0
1 |! k: M1 l& ]var iedom=document.all||document.getElementById' K2 X6 I8 K' A5 f. z% X+ e, F
if (iedom)4 |1 S/ f3 u) j* g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 t# W5 `4 m" V) J. l
var actualwidth=''
! E% I- P" y, s1 A, v+ X* }var cross_marquee, ns_marquee0 P, |+ Y2 j0 f4 Q3 B

5 c, K7 z6 `2 l* Yfunction populate(){% m( U1 A" r1 v% ~" [
if (iedom){
; I# e" h% H8 h% U& o2 v) Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. F% Y- O) f3 s; Y8 rcross_marquee.style.left=marqueewidth+8
  Y' [' m( A5 M. N( D* ?cross_marquee.innerHTML=marqueecontent
4 Y& c' s' i: X" f$ ~8 r$ Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 \7 U( M, f( }3 w  Q}
% ~1 C; `  t- L/ y' Celse if (document.layers){
* H/ H3 a' ~$ _+ y7 y! uns_marquee=document.ns_marquee.document.ns_marquee2  o" Z+ l3 X2 U+ c6 r5 w  [5 _7 h2 |
ns_marquee.left=marqueewidth+8
6 H8 K9 P4 }+ b6 V0 O6 h0 Hns_marquee.document.write(marqueecontent)
2 n8 C9 c. n. O0 s1 pns_marquee.document.close()
; Q& D! x6 y2 a( R% T6 V4 Y5 w' \actualwidth=ns_marquee.document.width
4 m9 l- P. M) R  m/ x, x}
9 l+ @, L# T$ x% w1 ]lefttime=setInterval("scrollmarquee()",20)
) P5 R& b, u; R, Z/ C8 l) l}; w9 A8 Z6 b1 M# Z$ d) N
window.onload=populate$ z% f& O! y* v" U1 N! x  w' F

5 _7 j3 E/ m( h" r' Cfunction scrollmarquee(){
9 @5 z6 \6 k0 T, ^if (iedom){
+ U0 U* S3 ]( U) S) g3 H0 _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- X5 w6 `; j8 N7 Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 l0 ]/ g, Y. k- D! o* Lelse* [0 h4 }7 |3 {4 l5 u( p! E, K
cross_marquee.style.left=marqueewidth+8
! P4 h6 e) }1 B2 q& ]) v3 g3 d+ N
}
4 V+ g6 `0 e. F$ m, b7 U6 L8 R5 n9 n  qelse if (document.layers){, I- S" ~) q! Y3 [% d3 W
if (ns_marquee.left>(actualwidth*(-1)+8))' g! ]) v$ d$ A8 t- |
ns_marquee.left-=copyspeed
3 X. r0 t0 M& |& w- X( Helse$ g, ^( P, s  x3 \- i/ x; e
ns_marquee.left=marqueewidth+8) y) @- x  Y+ m
}2 ]% @) F, Z  H7 f$ i
}7 l# t' x8 g) G$ P7 d1 C, V3 f5 {

: i) \/ d4 D- l, U7 g  vif (iedom||document.layers){1 ]/ n8 ]/ L; S% }2 Q8 }
with (document){
8 {0 E, t) z$ d; f2 Q7 ^4 fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 w% P, j, h" xif (iedom){: z* O/ ~# M/ h0 J) L1 }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" c& q: s/ p; C. ^, ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 ~4 X: R. F& r" Z9 H# W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 S$ z  ~8 N4 _( A
write('</div>')
7 E5 _4 ^% |' C( R$ c$ ^}  G4 s. S1 `5 g* X
else if (document.layers){8 j( J8 K" d/ G! L+ y- w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& \. X7 |" ~7 V7 vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ Z" l) j! j8 i0 \# o9 Qwrite('</ilayer>')
6 L( k9 S3 h$ q$ f+ Q}( n6 p/ Y: m- x. o4 z1 d* S
document.write('</td></table>')7 h. |& y- l7 ]' |2 ]; m  @
}
+ p* L3 s3 F/ M5 z) h4 `}# T+ Z) S( Z$ o# B+ @
</script>

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