返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ `- ^6 N& ?6 }. F# K# i( s
var marqueewidth=3008 m: U  [+ ~4 U) g% r) q. B8 H. x
//高度$ P- L6 k1 ]* ~, {3 H
var marqueeheight=25, E) e7 f% I5 u: \2 B2 ~; w4 Q
//速度(1-10)
0 B  h3 k8 h0 r% \1 ^+ F% J$ Tvar marqueespeed=3
# i5 N* a$ T: b. z; l9 ~- L* e//背景颜色
3 I5 y7 I6 S- vvar marqueebgcolor="#FFFFFF"% g7 K, [- |4 O0 J! g9 H
//是否能暂停 (0=no. 1=yes)?& [. b( R4 x0 G$ f* A
var pauseit=1
$ J6 r5 O) K: @% M" c4 |! {4 D+ v# ^9 @" d5 M: g# ?
//修改显示内容0 ^' \6 j; U" Z2 B3 [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# }6 \$ s' Z, v1 r; ?3 F. g) u, D7 e7 }- J2 M  o
) `1 [" s& W% {+ h
////下面不需改变////////////$ X1 M: z7 g9 ~7 M1 s

  i! @- _' _9 ?' k& t% l/ B* Yvar copyspeed=marqueespeed4 v, _7 n. A% }0 M( y
var pausespeed=(pauseit==0)? copyspeed: 0
' o, [- [1 l* q) Kvar iedom=document.all||document.getElementById0 U, `1 U! O, u5 ]  I! ~
if (iedom)
0 t; m' d2 x; l) a' E% W* Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 H8 ?3 L1 M8 C* X" b# P
var actualwidth=''
0 [# j- B( h1 X# N7 Svar cross_marquee, ns_marquee
0 T) }. m# n( W& F' H! M/ _! P* w; K/ j1 N0 e  Z# a
function populate(){1 i3 j  l* s* o, U
if (iedom){
& y: y* F1 h) K" V- Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- b& ?1 I; x; n$ C: Tcross_marquee.style.left=marqueewidth+8
# L2 e+ L0 u5 ^4 n6 t) @& |. ?% F# ecross_marquee.innerHTML=marqueecontent8 r$ i3 O, s) B7 e) w( `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. A, K# K4 b9 ~
}4 ?: i% B6 C& K! f( l* T5 w9 E
else if (document.layers){. d3 n% b! F% U+ H' L+ }
ns_marquee=document.ns_marquee.document.ns_marquee2
* b$ z( U7 T0 p" G8 C, Gns_marquee.left=marqueewidth+8
# g: R( B; {: S. D- C% p4 I( nns_marquee.document.write(marqueecontent)  ^/ ], `& O6 s7 l; g0 H% I
ns_marquee.document.close()0 H; X* m+ g  {/ x! L" o$ ]
actualwidth=ns_marquee.document.width
) I8 G, b; b+ p# Y- R; l}
$ I8 m+ [$ ]9 w; w6 I. u! plefttime=setInterval("scrollmarquee()",20)
6 v  y2 f* ~2 a3 p0 O}
, S/ ?0 m( N+ ]$ A1 E$ K5 rwindow.onload=populate
1 S1 r3 s% g! g/ T! w3 f$ ]" Z# }0 `
function scrollmarquee(){3 l+ P" B: H1 `! Z  E
if (iedom){6 `; A2 v, y6 V! M  X6 W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 R- H" w" H% t$ E4 _2 l$ r# j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' @7 F0 b5 ]9 Y; c) w4 P/ L
else2 y0 J: ]+ X$ d7 T" P  p
cross_marquee.style.left=marqueewidth+8
4 u# h7 k% Y- H# ~/ q- B" U: D: b- P. e% W# Y
}& [' J% X' j1 Q7 k. h
else if (document.layers){5 M( h2 a7 H4 M1 c( @( J
if (ns_marquee.left>(actualwidth*(-1)+8))
9 q6 h) p- I. w; \3 Ens_marquee.left-=copyspeed
. O4 }9 h! e8 i9 gelse$ l7 w! l% q+ a
ns_marquee.left=marqueewidth+8
# Y: t/ o, X3 U! A/ n+ a; @}
. G5 e& Q8 m' D5 [2 C! Y+ ~+ v}
, f: V+ C: d* e9 S. U: ?$ k9 J% q- Z( a4 d2 W* \+ z9 r/ o5 O
if (iedom||document.layers){( d5 p, U  p* C8 A) p
with (document){
3 f  m8 N: b3 I( B; _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' ^4 N3 k8 `' F$ |if (iedom){+ X5 s- z5 H' f' h5 Z( l+ |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 O. v1 C6 c$ R8 u- T- Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( ]% @+ ?: ~/ z3 R
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) ?3 B$ D8 S+ {# G, e" _8 T
write('</div>')
- ]3 a" C+ K! Q  F) s; F}
- m% q6 B2 ?, J" j/ f4 I. @+ A0 ^else if (document.layers){  p- m. m3 G( H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 B/ w+ A0 y% `1 n  jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 b! h4 z& y2 r2 n: f- _
write('</ilayer>')
7 Z3 H4 y) G6 @) |}
& O, b7 W: Y/ |& S" Adocument.write('</td></table>')" V  U" W6 D1 V" Q7 Y9 I' f
}: z0 {4 ]* b& G3 `6 }
}# d( q( x2 }2 X9 o0 e
</script>

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