返回列表 发帖

网页之跑马灯文字特效

//修改宽度. |3 c' c8 L3 W' D' b
var marqueewidth=300
  H& @2 Z  \+ ^6 t2 l1 [/ N//高度1 b: e. ~& T$ _* p( e
var marqueeheight=253 i5 O8 Q9 x4 G) d
//速度(1-10)
# N" f/ O+ s! @& X2 v& ^var marqueespeed=3
8 _. u9 |9 \* v//背景颜色
$ U/ V! B$ v; P, N5 R" W& K( O4 ovar marqueebgcolor="#FFFFFF"
. }% @/ b/ T4 @//是否能暂停 (0=no. 1=yes)?) f* e/ z; k% y: Q: b7 c0 `% o
var pauseit=1; _" i/ i  d4 u+ f4 K7 f1 s; _
6 B, J, l( _, N
//修改显示内容0 I" `: A" w% X8 d( H. P1 V+ ?; K" V( W6 g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) a6 q! o4 b3 w1 t9 @8 M
  G  l9 O5 G) i9 r3 y: E; O( X! `9 w% {$ A
////下面不需改变////////////
8 x' H& G: {9 D0 C7 ~
/ a5 h0 J6 y& rvar copyspeed=marqueespeed; H* Z% O. i+ Q$ Q% Y- q! O
var pausespeed=(pauseit==0)? copyspeed: 0
( i. p; {& b! Y% `/ V6 J! Q- hvar iedom=document.all||document.getElementById" j: X9 w3 d/ q; ~, F
if (iedom); [! h2 \& v  k% ~) b# k
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 _' G0 ~# D+ ]var actualwidth=''
9 U. q4 V0 D$ V; n# Svar cross_marquee, ns_marquee
* X* E# W. B$ a0 u; E/ A2 D' H0 K+ s7 d% j* S' k
function populate(){6 |8 k; q# u" N. h  e
if (iedom){5 w0 W- g: X2 q- K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, V7 m) q- ^; E! D, ncross_marquee.style.left=marqueewidth+8
5 B( d5 O3 q9 D' f' R! R! y# Rcross_marquee.innerHTML=marqueecontent
2 ^* F3 W  Y% I+ V5 N( c" ~# Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 C3 o; Z3 b0 n; O}
3 u; I; I4 Y% e; H! Jelse if (document.layers){$ |2 L1 F* ]7 K+ j% u. C, [/ z- J
ns_marquee=document.ns_marquee.document.ns_marquee2
* c% j8 ^' C% ?9 l% Vns_marquee.left=marqueewidth+8* V- @, l( l: x
ns_marquee.document.write(marqueecontent)' a8 B2 W* ]0 \  p
ns_marquee.document.close()
/ X  g1 O! J' i, H* n9 ?actualwidth=ns_marquee.document.width
# ?( v) x* X4 P8 ^) [' K4 j}
8 f  X0 Y' o7 V4 o# ^lefttime=setInterval("scrollmarquee()",20)! P) K6 q! B% F# t+ n6 U7 n
}
* x3 A, ^' y% r" {: Iwindow.onload=populate: U7 Y, o- @1 V/ ~% c
* i, N; v$ E( o: u# O$ t' C
function scrollmarquee(){
6 v; ^; P$ X- M8 l/ r  uif (iedom){* ^6 J- h$ l. h. l" _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 W8 M0 \5 f; Y+ M1 r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" }3 X3 |, Q& ?7 Z9 d4 celse& m$ x) w3 m8 ^) H# \6 z
cross_marquee.style.left=marqueewidth+8
& }6 A1 P1 x: Y+ J( U" C7 r8 l! t# L4 Z1 j* |0 v- n. y
}
. j  K! H2 e" `) \6 J) X/ I4 zelse if (document.layers){$ d* L( y; K) @$ L' ~
if (ns_marquee.left>(actualwidth*(-1)+8))$ |" K9 U- @- e: q, m, ]+ p" v
ns_marquee.left-=copyspeed
) v( ~/ T( ^0 F; f0 x! Welse8 ^& c2 h  ]  z2 Q
ns_marquee.left=marqueewidth+89 Q* R& S3 q9 S" V/ x
}8 B0 ?+ k" _; n( A, H9 ~6 E
}
2 h$ s3 |# d6 o
9 I6 H3 _/ C: S- W9 d: x% u, w9 Bif (iedom||document.layers){
2 A& [) H+ Z9 B) H: |- ?with (document){' o- E& u- M: y4 F$ h8 h0 f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% P' z; y  x3 L4 {
if (iedom){7 n9 U' k" G$ N* t! v  K; X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; U' g* X. u& E* h% ^" ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  R2 b% F% ?1 K/ K- [1 B9 }' gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" o0 k) ]: X1 p* Q. @write('</div>')
0 p! P# A1 |7 D3 V2 ?& n$ m}
# z7 j: o8 v7 i$ a8 I) ?else if (document.layers){7 g: Z3 y* i6 f$ b# W% S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" O/ t& ~3 u0 D: |6 Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  i% a8 X; [9 E( h( @6 V
write('</ilayer>')
' D' E1 k3 Z4 z5 G- C! B: j}% |, s9 y1 J. ^2 D/ A; r
document.write('</td></table>')* O& h! R: P& v) x) d. r, W) \
}
% w2 m! I. O: h, B# |# P. F}
) u! {6 S  }5 {( v# x; ^</script>

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