返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& \3 G4 N) z8 g" W+ }1 i2 Rvar marqueewidth=300
" A5 ]# }8 L, f" p! f//高度- K) {$ l& g, a/ m1 m0 P
var marqueeheight=25
' N% q. J) M. t3 Z4 }: b( ^//速度(1-10)
! u& L! d' [8 Svar marqueespeed=3
8 {* y' f- h) I6 b# L' w+ t//背景颜色+ q1 K0 y+ |* H
var marqueebgcolor="#FFFFFF"
* Y2 P8 e( @: E; ?! \# ^' g+ e//是否能暂停 (0=no. 1=yes)?
. X! A8 c0 N. nvar pauseit=1
, q+ }- G0 l' i, H5 X# D, [2 \
/ }8 m1 e; |/ t) S! u//修改显示内容; y. e3 Y; G4 u9 A; P; Z7 x9 P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': e; G; L7 z5 O

8 J+ q' S2 c# ~! o! m9 n, g+ [4 B
1 i0 u1 e, O. [" z  q- a; D////下面不需改变////////////
% r5 b8 w1 N" p# t( t
/ p, s6 @7 y1 h: Bvar copyspeed=marqueespeed
( k; w4 G: j' H; ~# A0 [var pausespeed=(pauseit==0)? copyspeed: 0; @& Y7 p% Y0 j
var iedom=document.all||document.getElementById9 p" Y$ A6 c; }+ E5 }9 {
if (iedom)
. k" z  h5 z( ?4 |# y# _( gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 D% J+ F8 b/ M1 z9 w$ uvar actualwidth=''
/ l& X+ G% k$ o9 f, Rvar cross_marquee, ns_marquee
! Y  G4 Y: Q" H( i+ E: }; [0 V% U) u) f) b8 _
function populate(){- Z* |  }6 E; P8 C9 V# g5 ]5 d$ Y
if (iedom){
, ?# m$ ]+ o" v& C7 b1 Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 E# Q0 L, C! h- n+ a& [6 W; U: C
cross_marquee.style.left=marqueewidth+8
" w% p" M3 b$ y5 e: G  M! Rcross_marquee.innerHTML=marqueecontent
3 |& o2 {/ }- @; a) kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# y* h( x+ s0 d- Y$ w9 J- M( Z
}
. s; V  q3 u+ Z' C) X/ d  R( Oelse if (document.layers){
/ a9 U& H" Q5 b) Sns_marquee=document.ns_marquee.document.ns_marquee2
- ?# ?& d( n, s! _+ F! V9 ~  \ns_marquee.left=marqueewidth+8( e! Q0 T, ~* `  x7 x$ Q8 L$ J+ v/ l( i" \
ns_marquee.document.write(marqueecontent)
4 H4 d% Y* [* I8 U0 @+ g* ?- Xns_marquee.document.close()
' y* A  \7 c4 T8 P$ m- Aactualwidth=ns_marquee.document.width
. t) _* a) o: _7 ~}$ o$ P" B9 C+ b8 p9 i9 l0 i% s
lefttime=setInterval("scrollmarquee()",20)
) w0 F; d* H& |: ?' V- I3 c6 Y}$ Q* F  v) R5 Q6 g4 h
window.onload=populate, x/ J& q3 \8 z5 W$ a
% ?; w) f: O  b' Y; R3 Z$ z5 F
function scrollmarquee(){/ o3 I6 x7 g- c0 p6 C
if (iedom){: l! C( a9 F8 M5 r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 i5 T4 R) x# R  W# E* J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ U8 y2 b/ A% O1 @else% b. e3 ^9 T( B2 Z4 i& E
cross_marquee.style.left=marqueewidth+82 G8 ]) w) ?" ~
9 T( h+ n! V  Y- Z7 F, I3 v
}* X9 [$ h/ r% U4 p& i/ X
else if (document.layers){2 a% H. V; j+ }' Z. L
if (ns_marquee.left>(actualwidth*(-1)+8))
1 B7 M: m+ {" G2 t* u0 O. |0 Yns_marquee.left-=copyspeed
! G0 T; Y& K* a$ g! c7 m0 }1 g2 nelse$ Q: N/ w( |9 Z6 M) Y+ \
ns_marquee.left=marqueewidth+8
% {6 m! T& t1 E7 y8 c( X}
1 `& M1 s  J# O7 Q) U+ R}
5 `* J# e0 o0 u1 g" ^
. O& ?7 L4 `+ f+ D/ Pif (iedom||document.layers){. E/ _* H  f" R4 ~4 Y
with (document){
) f# B/ G5 V/ g9 adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# j: G- I: @- O% ]! P6 F9 p
if (iedom){
% V; O; [: x9 F. C; j9 iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 R7 J; @6 C+ k$ w! ?6 r  Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, k3 e: }  B$ ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 T( f& U/ O% W, e3 C
write('</div>')
0 a" D$ J1 z+ Y$ J* U/ c5 e! f}
; r. @& a  _( l+ T/ ~6 [else if (document.layers){
) ?& p8 @! O5 I* B7 mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* S. E) I7 U( Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 x- W$ f3 u: c( U' }! Twrite('</ilayer>')8 i' x, m% Q" s% y: ]
}
' P4 I0 [! v2 E! X7 Idocument.write('</td></table>')3 B7 E8 S( v, o! P3 F- O+ Q
}
& D8 c3 B1 j' h- `  Z" T( y4 |. g) B}
2 H3 v1 ?  w+ e7 ]" c* L1 p/ `6 B</script>

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