返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ P4 }: i2 C" \var marqueewidth=300
& N, o" E# Y6 i$ W//高度1 v- m* H3 O3 k; k" ?
var marqueeheight=25
3 m0 n0 D- b3 J, L//速度(1-10)" k6 E  X3 @4 J
var marqueespeed=3
1 p7 `1 {$ Y) l$ g: e  ^//背景颜色
& _3 q9 B) ?, T  c' tvar marqueebgcolor="#FFFFFF") ?! @) Z8 I. ~2 U
//是否能暂停 (0=no. 1=yes)?$ m2 m  z. H0 N) B& u& s
var pauseit=1
7 g. m2 `0 F  e- j: x, x+ H
6 i1 b1 j& H/ E5 q+ }8 `5 E- H8 G//修改显示内容6 n: C1 i, ^5 p# C- H4 r. n5 Z" G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 j6 m6 F4 w/ _" s9 E- B0 i
# z$ ~8 b* P0 f9 E% q
) x9 R" P" B  Q, }: S////下面不需改变///////////// `' N3 {- i/ t

* r8 F7 ]- @6 k" x4 Y) E7 a- ovar copyspeed=marqueespeed- n1 B: Q* b" l. _0 D/ H4 p5 [
var pausespeed=(pauseit==0)? copyspeed: 06 L# H$ _  j6 m* G' m- K( ?6 t
var iedom=document.all||document.getElementById1 v$ e; K( M9 I) W  e  h
if (iedom)
$ Y6 x0 J4 P/ u1 R3 Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 P- W6 S6 w$ d9 xvar actualwidth=''; I" [+ I' W8 E& K/ ~6 V: l
var cross_marquee, ns_marquee
- D  K) p7 {" h$ W. d+ y7 |4 z8 e( d) \8 e+ Z0 E; a2 ~' j2 ?
function populate(){
4 J% R3 b& _; h- m& Gif (iedom){( q- I( U; x8 f: b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' i  c) X  s4 N" D% s6 f2 [0 B9 N
cross_marquee.style.left=marqueewidth+84 _7 O4 N1 l$ m% q
cross_marquee.innerHTML=marqueecontent0 ~7 N  f7 V* T. a# c4 C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. a4 S& A2 S8 @1 i' V! e& N1 |1 M}; E  t  _  R6 O$ S
else if (document.layers){8 c' j) b. f* X3 Q4 W, G) M' F
ns_marquee=document.ns_marquee.document.ns_marquee2% P) a9 S5 o2 F/ X
ns_marquee.left=marqueewidth+81 ]8 f4 |" m* o: F; r& W
ns_marquee.document.write(marqueecontent)) \% {+ C9 k& D7 Q7 P* T
ns_marquee.document.close()
  W: o$ O) u# ^: e& k2 Kactualwidth=ns_marquee.document.width6 ^+ y. X, s3 l/ c& I; V
}6 X3 J( g" t( ?. h9 R% J/ p' _
lefttime=setInterval("scrollmarquee()",20)
1 k+ V( [% d, h}" j& k$ H! W( m1 x$ U
window.onload=populate
' ^7 n. o' r3 y# L3 |8 K! q0 \( B. n" G9 k9 V
function scrollmarquee(){
7 O0 l5 u0 B7 \" l' ?" s: I' u: J! Pif (iedom){% J9 {$ h3 }0 G( Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" V' u' P! b- Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 I  P5 j9 j0 K! X1 Aelse" ?8 k6 r2 u% }6 `9 r- h  O
cross_marquee.style.left=marqueewidth+84 ]6 s' e7 v, l0 e
, b8 }. g3 i9 g' V( \# v: H
}- t% G  O- z( O. c7 `! y
else if (document.layers){  x6 O% X- Z/ w  M% H. |! m* _& J
if (ns_marquee.left>(actualwidth*(-1)+8))
' ~3 y* D: C+ N! I4 }ns_marquee.left-=copyspeed4 s6 ]8 R7 [- e$ V5 S
else- _' V# `/ t4 s; Q7 [, d8 m
ns_marquee.left=marqueewidth+8
. H8 g& X1 x6 G  `}
1 z: S# e" z5 i8 N, l}4 h# ^9 M; |: G2 s

" v# w! a5 G5 L, d7 K+ T2 rif (iedom||document.layers){" ^3 X2 f  E4 }7 N$ J
with (document){
. {3 E/ B/ e" y% a* O8 I) udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; X7 n( t! ?/ I% `: I& p7 _+ W8 }if (iedom){
+ Q/ d) r! W1 g+ Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' x$ v% a* h, F, k$ m5 @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 S6 G* b5 q! A: M# C7 I4 j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 D9 z: b0 B  ?9 L9 Hwrite('</div>')* R& y  p- ~7 R
}
" s. G: \4 o- Q6 q: Jelse if (document.layers){2 k2 d6 r$ c4 p4 ^( ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); i% ?6 |9 K( A' |$ |, W: |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 D5 J7 J# N% a$ D' v* Nwrite('</ilayer>')
# V8 r. R. Y' a  H}8 O: r8 R& N! e1 V( g# l! x6 u
document.write('</td></table>')3 f/ x1 M9 p0 K- T
}
3 i) J% E4 Y: E7 \9 p* \2 c}
/ j% }& }( H! ?: v" B</script>

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