获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度* S5 P0 }! r; V% }* I6 u4 r! O% I
var marqueewidth=300+ I3 J; p3 G, L# }) c
//高度1 n2 s; w5 X% o- `/ N$ {: t
var marqueeheight=25+ w6 j5 S: F6 W
//速度(1-10)
8 k9 [% p8 L0 y2 e) n, Pvar marqueespeed=3
' R6 v  L2 u: Q- q( r/ s//背景颜色9 u! W( i, a  |* R; y
var marqueebgcolor="#FFFFFF"0 N+ i6 s5 Q, b8 N
//是否能暂停 (0=no. 1=yes)?  W- r, O! M* e" c. z
var pauseit=1
0 h6 E  w, z! d, z
" {( ~( G" W" c" a! |% r( r! [* }//修改显示内容
, c8 f# Z. U) a+ T  x1 z! F( ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. e4 y  h  x- q* i: n
& e8 c4 p0 c3 d9 ^  U
. v$ |/ T" q6 ?; K* f3 G
////下面不需改变////////////' s0 K# ?2 q8 B3 j

; g/ A: a2 ]2 H0 fvar copyspeed=marqueespeed2 L/ h- E$ c( ]! a9 r
var pausespeed=(pauseit==0)? copyspeed: 0, I: @! f  x5 w* [% W
var iedom=document.all||document.getElementById. t, x5 H1 r, Z& K* \6 l- w
if (iedom)
  K1 J4 s% Z3 Z, e$ K% `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 o& ~; \: U: s. Z& K" L9 v
var actualwidth='') T) j+ L  |, i1 u
var cross_marquee, ns_marquee6 l: P: x: Y" @9 h- n4 g
$ t( J' U9 A% k9 K/ X( e. M
function populate(){
5 ^4 g4 L3 C5 |0 ^6 vif (iedom){
% X$ `1 S/ ?; L" ]; y# bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- ~: m* F; t# s, H. xcross_marquee.style.left=marqueewidth+8
- `! y6 O( R- {! fcross_marquee.innerHTML=marqueecontent
0 ~2 |* c9 O8 V9 vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& G' u3 H/ ~! {0 C8 O* S}
( n* Y% |% P4 Welse if (document.layers){: k  K3 k6 U5 s7 n
ns_marquee=document.ns_marquee.document.ns_marquee2& [4 d- c6 E* {% t: a6 P8 r
ns_marquee.left=marqueewidth+8* D% L& l2 K$ w6 s# n6 r) D
ns_marquee.document.write(marqueecontent)
! U1 {" I3 S" O# x$ yns_marquee.document.close()
6 g, e4 I, H: b5 E% ^+ V. p! p; l6 Hactualwidth=ns_marquee.document.width
& g, C+ Y: @% R3 x9 S% A}2 [8 P- F9 l+ U* A
lefttime=setInterval("scrollmarquee()",20); N9 K" F- a. @1 F
}
! }/ D- I1 x3 O  ?9 s% w: ~6 nwindow.onload=populate
; W! @6 O. O2 v" k* y4 f% R/ r$ Y7 d- G2 M
function scrollmarquee(){
# Y  ~' [9 x/ ~  k3 V1 _if (iedom){2 {& f' q8 m: t* _5 K+ D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  E2 Y# I+ C# n( A! X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! a8 B' e+ t  _& D' d7 Velse
# @. q, \0 j3 i: N. s' Z& Scross_marquee.style.left=marqueewidth+8
2 G1 a) S# P2 ~, [$ }$ [. c% W$ P& k
}
" K5 ~2 v+ l. j3 j' q0 g! ?else if (document.layers){4 d7 R. `$ j! m! e3 T9 S0 O4 y
if (ns_marquee.left>(actualwidth*(-1)+8))* C. `- r7 I0 L- n  K
ns_marquee.left-=copyspeed+ Z3 M9 g9 x/ N. H" D; p
else
7 o. I1 z: N' v) T. V! i' G& b' jns_marquee.left=marqueewidth+8
5 @5 s7 B3 j6 n, U! `}
7 V) @, g, X6 E- z3 i9 z}
& R* x( y9 c3 Q5 k
- \1 X+ i* t: l8 M( x% Xif (iedom||document.layers){
- P' [+ k$ k" y: j" ]/ \' ]- \with (document){$ N% U: e: `6 M4 r8 Q8 R9 a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% u8 G: ~% Y& x& A$ B, T$ m
if (iedom){
) ]" u; A1 q5 gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 }* ^* l+ Q& n8 q1 S5 K, r1 f2 j9 pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- d8 o  n/ i4 f; D& p  q2 Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 f% }6 A8 x; ]5 Z
write('</div>')
: N8 p5 j# A% d+ b" m}
2 x8 G& l  b' p1 d  T4 N, h9 _& Ielse if (document.layers){! n& n% W$ z1 _0 S! }5 O- H& Z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& a# ]$ S4 d3 r( Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ [$ l1 U1 u; a' K; k9 U  g. Y3 `
write('</ilayer>')$ |3 m* H  A5 b) }' q5 x
}! E' E' o7 a7 ?6 Y- D4 {# U0 P
document.write('</td></table>')8 x3 M- R3 x# K# b4 t
}
4 V. }# P9 |% H}: b0 t' G( W% ~! j
</script>

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