返回列表 发帖

网页之跑马灯文字特效

//修改宽度' V& U  `' |* X8 t+ A/ C
var marqueewidth=300/ f8 i. Y  U  K& w; k
//高度6 N8 l: F) Q- i: U
var marqueeheight=25
. Q3 \( A3 J' V4 p7 i% g//速度(1-10)* x4 Z9 h4 b: D) D
var marqueespeed=36 q- w  G; H8 }( Z4 |% V% g( l0 H
//背景颜色
' ^& B' g% W& [1 [var marqueebgcolor="#FFFFFF"
1 e& [6 j1 M" a$ n//是否能暂停 (0=no. 1=yes)?9 z, q9 e+ b# L" H# @" Z" [, M- m
var pauseit=1
, Q7 O/ H2 \9 i, A$ K. b: W" i0 G) ]' ^! A/ E8 Q2 c  x
//修改显示内容3 Q' Z6 |5 o* c% u4 ~" Z4 V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 l( m3 m+ O- v) b) ~

3 Q' x  b. Z# x9 N( V; B6 K! ]
# k; l# u, M8 K2 C9 q) E( U5 C////下面不需改变////////////
3 o2 ~) ^. R( D0 Z: l0 [4 ^( f
" o1 R( h* m# L& N! u/ Mvar copyspeed=marqueespeed
; s. J' ^  ]$ i& o: q( w9 ]var pausespeed=(pauseit==0)? copyspeed: 0& |' Z, O0 T! a; x. v
var iedom=document.all||document.getElementById
# g# d6 V( G8 g8 T; Rif (iedom)
; {+ n# f7 i, C2 j5 J8 w. vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( B$ {3 m) p; K9 l( h. w+ Zvar actualwidth=''
. \" p% o6 a' D) r4 V% Y  Jvar cross_marquee, ns_marquee
2 M- Q- s$ S5 m( P0 Y. D0 [$ O
) c+ `) {8 q  }* ~$ T6 q( h% O4 Qfunction populate(){
# b8 J3 i' O! c; u0 {  G- x# Q* X8 [: kif (iedom){6 [6 i; w6 X2 I) v3 S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% y- Q) h( z5 L6 R. R+ ncross_marquee.style.left=marqueewidth+8/ |; s1 S9 S; B- u! m4 b
cross_marquee.innerHTML=marqueecontent" V. a$ m+ ]) o6 q: V; l  F0 L# f
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* L7 z" B1 J2 G: f9 M9 [}
2 E" k) w( }9 s* n0 D8 ~else if (document.layers){
: U: v3 B( N6 t9 |ns_marquee=document.ns_marquee.document.ns_marquee2  d2 C2 j! E  n: d) s$ G3 ]
ns_marquee.left=marqueewidth+88 E! P- O5 c* P* n. k; ~$ m  Y/ z
ns_marquee.document.write(marqueecontent), v1 B3 D( R7 v
ns_marquee.document.close()/ @1 ]' ]# L2 x/ V1 p9 A* Z/ l
actualwidth=ns_marquee.document.width: E" I4 q5 p/ H: G6 b/ ?- e
}. q9 n! z( O0 \& Q9 Z
lefttime=setInterval("scrollmarquee()",20)$ m6 N' d9 ~$ _6 o0 i$ T5 f
}5 N4 z5 {) {5 K4 B: C
window.onload=populate
0 ~3 m2 M2 [3 Q0 b6 N& J% Z( j+ p$ }4 D/ u( {& l% }
function scrollmarquee(){. s3 H+ o/ ?. t, a6 Z
if (iedom){! }% t( y- Y! {* r/ V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 H( }$ u( E$ D8 V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 D( ~) M- V& R, E  {else
+ {- [7 x4 Q. E$ R) W% G  V- tcross_marquee.style.left=marqueewidth+8
0 H4 E/ i1 R! H% @$ h0 m
0 K2 P& X* y7 e$ y) r}
* a6 W. V! |- V2 q: welse if (document.layers){! l& ~$ l7 H, i0 v0 Z1 D
if (ns_marquee.left>(actualwidth*(-1)+8))
* _# F3 T" }' W. F8 O; D  c% [7 Wns_marquee.left-=copyspeed: q6 X5 A$ _0 V6 b% q) U* X5 E
else
7 O% M: ]- h8 }  Nns_marquee.left=marqueewidth+8: `# }* D* C: f, j; {
}" _' I1 F! x% o5 w% D4 x; z! @# c
}
8 ]% y6 s$ M% L' F4 r% }
; Y  t1 G) u$ f9 Yif (iedom||document.layers){. G5 |" B/ u% Y8 O2 l& _
with (document){  j$ ?6 w: Z+ b% g) G- P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 A& W/ ^# ^( P* Q9 H/ i
if (iedom){
7 Z: w4 Z! e: U9 J- t) c+ Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) ^9 F$ q' t( H" |; H4 _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 D9 w) G- H* |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" Q; B, H5 s5 w8 kwrite('</div>')$ {0 O% i: M& k9 c
}6 E1 r" Z; w( @4 f, t1 t0 p% a
else if (document.layers){
7 D$ B3 V+ a5 P( B3 O2 Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" c" y5 a$ ]# O3 m  Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% ]3 E1 o2 Q( |write('</ilayer>')
& v" u8 I2 p) |5 Y2 n}
: V9 B1 Z. D1 p* [+ fdocument.write('</td></table>')
6 D/ T; N% D7 V$ F+ ?}1 C) ]' y" f) X0 N
}
0 u" u$ j9 Q- q8 d" |& ]; n9 K</script>

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