返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ D' f4 K; K/ S3 J4 `4 l
var marqueewidth=300( E* ]# ~% y0 @' }
//高度3 V6 z8 C, T; x; |* G  I- h* ^6 V
var marqueeheight=25
5 p, ^2 ]+ W  Z+ s//速度(1-10)
- o) E. M  V( _var marqueespeed=3
6 S) S7 p, y$ b5 [* E- P3 }* V//背景颜色/ Q. v' b9 v$ c8 U* |
var marqueebgcolor="#FFFFFF"
( X' v0 N% o1 ^//是否能暂停 (0=no. 1=yes)?
* v) C. l  d" f5 Q0 l- Z" [var pauseit=1- d3 Y( R- E  F

) [9 D8 a6 R6 G8 e% P6 i//修改显示内容* H7 D3 I0 O6 h: L( r4 f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 i) c% b7 T/ s$ T5 K9 U0 V3 [

8 Z  k5 Q2 h: N, a: t$ t8 s: ?7 B; t$ m; i5 \1 D9 S3 s: c3 T3 a
////下面不需改变////////////
6 ~  U. m: ~& g8 r, o+ C: D$ s; Y0 t' F& _7 T/ T
var copyspeed=marqueespeed# ]) k# C) a: v, r
var pausespeed=(pauseit==0)? copyspeed: 0# _4 G7 N1 r- f  n
var iedom=document.all||document.getElementById4 T4 f8 o( u3 D& z* g7 p
if (iedom)
/ a6 j% u3 [7 Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ U9 B8 Z+ k, |* R1 ~var actualwidth=''* a3 h/ v2 R! w: @. R1 }  W% O: M
var cross_marquee, ns_marquee; }0 o: n( r6 y
- S) c. Z; r1 [
function populate(){
3 O0 U8 V6 Z4 h# q  j" {' q+ {( Eif (iedom){
  T- g" v* O5 F' v4 Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* q$ b( X8 K% k! O. M. Y: F# _
cross_marquee.style.left=marqueewidth+8
) S* I- v6 k% w3 o, Rcross_marquee.innerHTML=marqueecontent* I- n% v* h6 F/ k3 F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; e/ W1 b9 o+ G( h
}5 [% V# G. L, h' @
else if (document.layers){6 b5 M$ G. @6 E$ l+ |( L
ns_marquee=document.ns_marquee.document.ns_marquee2
7 S* E) ~$ M  i& `! g+ bns_marquee.left=marqueewidth+8  F- e0 H% M+ R
ns_marquee.document.write(marqueecontent)( K* s$ E8 g3 X5 J- ?" n
ns_marquee.document.close()# d, l# A- C/ P
actualwidth=ns_marquee.document.width# z; Y# V7 e1 U* U
}! z9 m3 ^$ D* d/ w- S/ P8 n
lefttime=setInterval("scrollmarquee()",20)5 ^) ?: a/ r# u; ?  a: n" e) Z7 w' D
}' ]6 q! y* m  A- z! H3 ]
window.onload=populate
4 ^* ?2 E9 v, E  x3 C% J/ w9 Q) H. l# @" v
function scrollmarquee(){
+ N' {9 P# p' l) C" Eif (iedom){
+ d: O9 E( \9 {+ Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* D" h. L# Y  P, G6 }5 q$ Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, j8 w, U2 c( I! v0 G) n! pelse
0 e5 `7 w' F4 o& \' ^cross_marquee.style.left=marqueewidth+8& k. X/ J7 Q- J1 D8 m/ }5 S( E
" q& W& G/ B" Q* j; E' ~
}) v% [/ ^/ ]' Y7 w9 h! H
else if (document.layers){
3 H8 v0 O6 A& e4 T" s( i+ pif (ns_marquee.left>(actualwidth*(-1)+8))' T7 u1 \+ e$ l$ a
ns_marquee.left-=copyspeed
% W+ F6 U5 T) ^+ _- @else
: s: B, r1 x5 F2 q$ U1 q6 vns_marquee.left=marqueewidth+87 K  W8 g: ?/ O( D4 l- v
}( ?+ s* Z& t6 L7 o! K* I6 A7 O
}
/ n9 k' ~; ^9 K; `8 O3 s( ~) |9 K3 A$ Y) L& M9 f" t3 x, R
if (iedom||document.layers){* P$ ~  @3 _# e% T
with (document){
1 C  v6 x, f: Z4 X3 w- f: m1 Sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 c) S5 Z1 ]  r) N4 Tif (iedom){
) m  c. m! N$ uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" E. I& k1 u+ x1 p+ ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 A: _; b% z' B7 c* C. b+ mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), L& K; U, `$ R9 P2 f0 W
write('</div>')
, x; Y  I* W, M% K$ w; p9 U$ Q}8 |* v' k- `' _* [# n8 @; h
else if (document.layers){
& H; p, x" [' }/ [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) D9 U! Q3 x5 F+ [, Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), ?0 {- j, \# ?( L8 f; z7 Q9 D) t
write('</ilayer>')
) F* N* m9 t0 ]9 O; C}
* y- B( E/ k4 w5 Vdocument.write('</td></table>')4 ]  Y: q( [* T; X& j* M/ |) U
}+ U! G2 V$ p5 y6 m8 W
}  R/ c5 R& u2 I) X& F/ g1 A6 _: V
</script>

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