返回列表 发帖

网页之跑马灯文字特效

//修改宽度" M6 ^) D. {! k  t2 x* R6 d+ F
var marqueewidth=300
% l$ t- w/ y+ t* @//高度
3 Z2 F, z# n/ cvar marqueeheight=25) t  Z3 E/ y* B( K) M, J' ^5 w) W
//速度(1-10)
) C. T+ ~3 H) V) H; ?. ~& E/ _0 {var marqueespeed=3% L$ V* e2 x4 a: o, |
//背景颜色3 r& K3 s. v+ L
var marqueebgcolor="#FFFFFF"
6 G. R' a/ K8 C4 t! J//是否能暂停 (0=no. 1=yes)?
/ {& G0 a; q0 I& t  ], D2 Tvar pauseit=1+ r4 N3 O* W1 Z) A  y
+ ], C$ t0 p; E5 s3 s- R  V# a; h+ a
//修改显示内容
! A, |. h& @1 u) Q7 C& Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" V9 H8 F6 N1 k# m' l3 O
$ [6 v  B7 @+ d5 T) x. G, {
# G  j; ~6 m( w: n8 X
////下面不需改变///////////// l; Q3 g3 z9 P/ m/ W$ Z0 m
7 N- W9 w& Y) K) Q
var copyspeed=marqueespeed
8 o9 ~! U% p. |5 n8 j4 Z5 ovar pausespeed=(pauseit==0)? copyspeed: 0
7 W9 L1 I  c( cvar iedom=document.all||document.getElementById
" u: w( ^+ v# T" _: q7 C% yif (iedom)
) {  J. h8 f! m4 e* y* }1 wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, x4 t0 O2 q) d) N; Z% O' ^var actualwidth=''
5 o) [! o5 u9 `  s8 `var cross_marquee, ns_marquee; J' g2 y7 c& r' c
2 ^3 G9 C* C% f% K  V' ^# M
function populate(){; j  {( l, R& _. W
if (iedom){
0 h; o2 U8 c2 _4 B: H$ Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* V3 n( g) |$ M# w/ P/ x! r
cross_marquee.style.left=marqueewidth+8
/ l8 Q  h$ _6 Y5 ~6 K. Ucross_marquee.innerHTML=marqueecontent
1 ^8 p; m& m! g& B  f+ i+ v& iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 t, d8 p2 h' x, C( _- R}. W- m7 J1 s0 C) D& V. X
else if (document.layers){. O# t2 O7 L5 t; I% v# a
ns_marquee=document.ns_marquee.document.ns_marquee25 r6 g3 ?! o9 N7 r- V
ns_marquee.left=marqueewidth+80 T4 l4 t" {/ o* g
ns_marquee.document.write(marqueecontent)) L* M. d' J4 M  X: q5 k# j+ r4 k
ns_marquee.document.close()6 t, b) N/ D) Z4 \
actualwidth=ns_marquee.document.width
$ W4 p, n$ R0 S$ h}
+ h: D- R+ l; b' h) K1 K5 ulefttime=setInterval("scrollmarquee()",20); \1 t0 X) E# F$ {
}
0 Z+ E7 m  |" t& Mwindow.onload=populate
8 I" A/ L: q: n
# p7 `- y+ h4 o; [+ D( ]2 zfunction scrollmarquee(){3 T! [$ T, ~5 B* ]" t
if (iedom){! E$ B$ t: K6 `' p8 M
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! Y- S  d% r; }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 O( B; N! y5 H. _9 n% _else( X% @' O- z7 Q2 r& j
cross_marquee.style.left=marqueewidth+8
9 ^, y" k: d/ A1 ^. {! ], x) M& }% I- z' p  i; c% \/ z% I
}
. ], L2 i. s8 y0 Y& z; X8 Telse if (document.layers){7 ]; c+ r) h- x  U8 e! M6 p4 O
if (ns_marquee.left>(actualwidth*(-1)+8))) S' d$ m; r- ]
ns_marquee.left-=copyspeed% C' H% A8 v; q% W
else5 U: B! o5 A$ D" O: t( L# s6 B0 W$ O
ns_marquee.left=marqueewidth+8
8 y0 }' d* d2 v}
2 j5 R- \% F( a. m6 ?  f7 ?}* X/ M9 J& ]! ^+ X2 c' U
+ ^& U$ V$ z% c- W" ^
if (iedom||document.layers){. S3 w, I- i% B* _, q2 `  f8 U
with (document){2 p- d& Y' [2 j, ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 ?. {2 z8 a) [
if (iedom){
4 M  ^+ n7 o8 _" Y7 c# X2 `$ Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 d$ J% T9 U% F
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* l% z/ J+ g( k+ `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ O1 F6 [' X- p3 {1 T* g8 E# z0 Cwrite('</div>')
# k  V" v  g, h; }: k4 [0 r4 C}+ ^5 r! u3 q8 _+ y2 y4 \& Y: x
else if (document.layers){
1 k2 {+ M2 J7 D9 e( d# \) }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), c1 T6 ~/ f) p8 ]9 s& ?3 y" m7 B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 J! X: Q' s/ s
write('</ilayer>')
1 i8 k# a& g! N$ }1 X" g: P8 j2 N}7 u6 F0 \! N/ r7 G2 Z' X  c
document.write('</td></table>'). V( ^2 a( {( _" X
}6 m- S2 i9 E. a2 |" ^* s
}% U& \& v! `# I  f2 a
</script>

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