返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. b' l$ {' d7 g: mvar marqueewidth=300
* s; E, z* G7 \//高度1 L) @# {8 G5 E( M6 s5 F. z8 T
var marqueeheight=25
" [; Y2 v1 v4 F. ^: S//速度(1-10)1 T7 G  c7 w0 O  N: t  t$ \# E2 i
var marqueespeed=3, Z- l, [, k) w7 A. I9 z
//背景颜色: j9 U& k5 w3 _- l. M8 W( S5 p5 c
var marqueebgcolor="#FFFFFF"
9 ~1 }- }, Y% E4 T# C3 I//是否能暂停 (0=no. 1=yes)?' h" \. I% I6 B6 {7 [6 ^/ z
var pauseit=1$ u  ~4 G. p4 T5 v- t, T, I& J( P/ f

; Z, `9 X* `: B" Q4 e  ^) ?//修改显示内容5 d; a8 d, j/ R6 D% U! n# M+ w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 Z& Y" R+ h/ ~) ]( |! `

+ w& k4 L  I* F; P1 A7 c
+ \$ {* C3 R' U  y1 U" Y* t( d////下面不需改变////////////
7 X2 \( A' n* p* }# J/ @# g% _0 b- @/ a. c$ g# x/ C
var copyspeed=marqueespeed% R0 i8 e" o0 _: |
var pausespeed=(pauseit==0)? copyspeed: 0
! Q- R+ x" J5 A9 m; G2 Qvar iedom=document.all||document.getElementById1 f: q! g4 T$ Z- ~
if (iedom)
2 V& s: o6 x( H0 u6 Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( d: p' P# h( f: l; Kvar actualwidth=''
  N2 ?0 I; `: n5 s$ \* Z; t' mvar cross_marquee, ns_marquee
7 d+ t& F" [0 O/ h  Q
5 ]  c  g! Q9 b( u5 Pfunction populate(){
) y3 e$ L. [8 L3 M! p" Q) Tif (iedom){1 I( ]! _$ L( h3 u0 T) S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, a5 ?7 k- Q, b
cross_marquee.style.left=marqueewidth+8( _# V7 a! ^/ L% ~: R# p
cross_marquee.innerHTML=marqueecontent; ?% T* k  Q' G1 m* h: m
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 g2 t, B, e* T
}
7 K* l  Y: B; helse if (document.layers){; h& |2 ~1 A+ W, b
ns_marquee=document.ns_marquee.document.ns_marquee2
6 S$ z# g9 Z( \& K$ T0 C2 lns_marquee.left=marqueewidth+8; X. V/ J' p5 g8 T/ j+ V
ns_marquee.document.write(marqueecontent)
* j& h7 Z' V  H7 n: Z/ i" W( {) nns_marquee.document.close()
& A3 F. E. V( ~4 [) E  zactualwidth=ns_marquee.document.width
) L8 s* h2 h5 d) A3 Y2 N# @( U- X}
" p8 p6 m/ v4 nlefttime=setInterval("scrollmarquee()",20)0 j" `& T- g! o4 ]. f3 E0 X
}
/ w+ l1 s5 I8 ^2 nwindow.onload=populate
& I$ |( j' o+ B' \' S- L  i: c
* [7 r$ a* G7 R. `, b; B6 cfunction scrollmarquee(){; M! c" F& C; D! o# U6 m
if (iedom){8 o; Z( W- W; y- H7 f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: V. L5 r( ^2 S: N# U% Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* R7 W. ?/ R! O7 G# C2 `: Pelse
0 k7 |" y2 M9 q) Z& r" V3 ^cross_marquee.style.left=marqueewidth+8$ p3 ~, P. T; i+ ?$ e4 h

  ?' i8 `3 Q+ v}
, }; t  e1 \1 U# d) W( qelse if (document.layers){
! L3 X! q% o$ Xif (ns_marquee.left>(actualwidth*(-1)+8))1 K; Z5 [% L% S# L) E
ns_marquee.left-=copyspeed
7 _) {1 p2 X7 {% uelse
9 a# l5 m2 A# Y0 X  r* w: uns_marquee.left=marqueewidth+83 E/ k' @0 K: }) A. @0 Q" ^
}
& q  Y$ o, x# A, @" O}
: g; x! C1 A- e7 A! v$ q" v* R, h! L9 G" h7 m. m# g
if (iedom||document.layers){8 G, e; a' X- }2 H
with (document){
+ N2 L  y4 v# I  bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). e) g9 Q7 \/ ^  @) P$ n
if (iedom){
( l8 s1 p% a. r4 W( swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 ?6 e  x* }2 y5 c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% A0 t/ j3 c. I" Iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* y! Y" R4 ^9 q4 }$ s' Qwrite('</div>')
; w9 N2 p' J% d7 r}) O4 E" B- m+ b2 L
else if (document.layers){4 i7 L2 W8 W* ?# c# S' h, e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 F$ ]' \& C' Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% E4 o8 D. s& J2 Fwrite('</ilayer>')
+ Y) E2 h9 j" y6 v  G4 G}6 L3 {9 y+ i% p$ k
document.write('</td></table>')
1 E/ k$ i' u! C. g* J4 n7 [}/ v. [* V7 p. o; c; A
}& x( }7 O" Z& L# l: C/ x, a
</script>

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