返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 F: }+ W# S; @; }8 A5 n
var marqueewidth=300
" D) Q8 h# Y( o//高度
' W* ~' Y" W- pvar marqueeheight=25# T6 _5 x- t1 ]
//速度(1-10)' D: N8 o4 _$ o3 j1 |6 C. N
var marqueespeed=32 Y4 t. c! D; \
//背景颜色
$ h% h; h: t- z0 z+ [var marqueebgcolor="#FFFFFF"5 b4 S# c, l& Q+ D0 q
//是否能暂停 (0=no. 1=yes)?
1 @" j9 e. o$ L) u0 q( z8 F, lvar pauseit=1% D0 L) t$ ]: a/ E( L$ i

7 {6 q# w1 g  w8 U5 a- O9 L" V- l7 D//修改显示内容( Q  n, w9 u9 k  |& e7 v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* z& E0 V& {( v

% l) n3 ?1 r! \' K5 H
5 H5 m( D4 c2 b; e% H+ N7 b) s6 }2 f////下面不需改变////////////
' [" Y% W* x5 I, `) T8 L0 m7 D2 q: k
) y+ E/ `6 C( Fvar copyspeed=marqueespeed
+ C/ L7 ]+ T7 p( L4 m" uvar pausespeed=(pauseit==0)? copyspeed: 0' r8 x% _; c% _% h! }5 O/ y+ r+ R7 W
var iedom=document.all||document.getElementById
; \: `: a" n% C- c; Q+ Oif (iedom)
0 i2 u+ c4 i% i3 |4 }0 Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 d$ p+ f! e( g2 X' Z6 a3 H
var actualwidth=''3 a" ^) F7 a  t1 Q
var cross_marquee, ns_marquee
8 U+ A3 ]+ T9 F5 z  L7 o6 V7 P# \+ a( K( C
function populate(){
" p* D& H# E" _# \* \# zif (iedom){
. o; w* I; j& Z7 j+ P+ F! F8 ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ ]  x7 J) \8 N( Ocross_marquee.style.left=marqueewidth+8
2 d; l3 k7 Q7 ]0 Q+ Y5 z6 G& Vcross_marquee.innerHTML=marqueecontent
- U+ t  A/ F+ x! T- M" F" Qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 _$ n+ W: P  P5 t7 h
}! H: q" F# f. g% E- n0 w
else if (document.layers){
+ ?  h6 S) E4 x3 c8 Rns_marquee=document.ns_marquee.document.ns_marquee2
/ ?. q. `! o: W( }ns_marquee.left=marqueewidth+8+ G7 d! L3 i5 Q+ @
ns_marquee.document.write(marqueecontent)- K2 {4 @- E# ?
ns_marquee.document.close()
: u! v1 W- {. c/ l( ]actualwidth=ns_marquee.document.width
6 Z; \  \; ~" h4 c: I; |1 u}. U5 c4 \' P2 B6 E
lefttime=setInterval("scrollmarquee()",20)
- h2 L0 o3 S! t, ~2 ?6 o}
4 L2 ?4 ^) l( _9 |# h& K/ p' v; |9 ?0 fwindow.onload=populate) \  b( T/ `( _
4 a6 _: Z* ^6 a3 \1 U
function scrollmarquee(){
7 ?6 F# y: Y4 l9 @8 X% s' gif (iedom){
5 a- [; L3 P5 f0 `+ f* e  mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 z/ P, D7 N; p( I( v' O! Icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; q4 F: s( [- r# e6 ?5 i3 a3 O8 Delse/ e3 F$ d4 l/ k
cross_marquee.style.left=marqueewidth+8! O+ T3 m* O* r' x: o2 D
) [; t) [" P" f( [/ r0 f! E; U
}4 N7 q. O9 B) a! a9 ~- B
else if (document.layers){
8 r" S5 ~+ m7 A$ U, I  i( [if (ns_marquee.left>(actualwidth*(-1)+8))7 z2 ]. }0 F( l0 A7 n
ns_marquee.left-=copyspeed
7 _6 V- }2 e. N; E$ e4 Y, M$ u0 }else: C, p# A# o7 k, r# V; A  {0 Q
ns_marquee.left=marqueewidth+8
, C9 @" `: d/ k) H) k9 u  |}: a0 G5 e  C& i. ^1 B
}+ s- \# g1 j) Q! }  u$ {# p
; I3 K* K1 E( p$ {4 M! _
if (iedom||document.layers){! }" j) b- m+ D4 |' N! V6 m+ A2 V
with (document){
; \/ h: c1 Q7 k  ]! Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 X' m$ d- A2 I& w
if (iedom){
! T9 |/ ]& a  K* D, p1 ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& B7 [* B6 J; h' @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ r9 M. f! p* i0 pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ D7 b- {. A9 d% z5 t# @write('</div>')
( Z* O# X0 F& S3 j( x}
. J$ j$ J  S4 r* B% ]) Gelse if (document.layers){4 I' M- }! t" w% t4 Y2 ]" ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 ^& b. C6 [! A0 p! B8 P% k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ n. Q3 z# X/ y4 hwrite('</ilayer>'). c6 B/ n# L8 r3 m- K7 q1 E
}1 r$ Z! T$ ^" i9 f1 w- |( M& o( U
document.write('</td></table>')4 j- A- A& g2 K/ P% C* q
}
8 A& P+ D7 [3 P}
- _9 _3 V4 |& [$ D" V/ z" z</script>

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