返回列表 发帖

网页之跑马灯文字特效

//修改宽度# u) S- n6 e! Q# G7 i7 l/ @
var marqueewidth=3005 V/ {" M3 D) |! [1 l0 `5 r2 G
//高度
  }8 C6 g' ^: K' Jvar marqueeheight=25
- f! q8 n8 |4 x+ ]0 C//速度(1-10)7 E1 |# _8 T1 q$ q9 P: o3 P
var marqueespeed=3
7 L8 d4 D0 R% Y2 T0 i* W//背景颜色
. G7 b0 K3 t( F1 Avar marqueebgcolor="#FFFFFF"1 n& g! |+ Z0 E# ]; c  m; Y, }
//是否能暂停 (0=no. 1=yes)?# j0 ?6 S: ?; }2 c5 J
var pauseit=1; Y5 y6 U6 L6 h( K, N, {' k8 A6 t
1 Y, J. U' b; e0 m) o: ~" H
//修改显示内容7 C8 I* p: T) x$ j; l+ ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  W8 p0 \# |: {- }
( g* N. {2 d1 p- g
9 k3 X1 p5 x5 X: f9 a) }) b8 o& F+ t
////下面不需改变////////////
1 `5 \- I; s$ ]: X6 f( m, M
! |3 J7 S: v$ y( }" M$ A" rvar copyspeed=marqueespeed8 R% d2 d. i- f) i6 Y6 d( c7 {
var pausespeed=(pauseit==0)? copyspeed: 02 x, U, i* g$ H$ H: e
var iedom=document.all||document.getElementById
! a; M  v7 F) }; s' Mif (iedom)* w1 h) Z# u# X9 i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ m, T9 `# X( ^! Wvar actualwidth=''
" c: I, a: r; e4 ?% ]+ i! gvar cross_marquee, ns_marquee
" C9 S2 d2 o: x3 V" Y2 _- D! H( t* ?  k. u5 C& D
function populate(){
/ L7 ]: }0 e) o* H( k% rif (iedom){
* O# M! V( _, C) Y, E; ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% M0 b0 U0 n2 U3 k' i
cross_marquee.style.left=marqueewidth+8
9 C2 U) I* P2 M% ^cross_marquee.innerHTML=marqueecontent/ P( W) b7 {" M5 E: y: K3 ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 P" L- ~  p' Q5 u}4 F8 m2 b* Y7 p/ a9 F( S
else if (document.layers){/ }! j" m, P$ P$ s9 l: P" g
ns_marquee=document.ns_marquee.document.ns_marquee21 A3 D0 s, L* x' i: Y; y' m) w
ns_marquee.left=marqueewidth+8% o$ I1 Z' H, s  x8 h/ Z
ns_marquee.document.write(marqueecontent)
' W  j0 `, F5 x+ V+ A3 r3 A% Mns_marquee.document.close()
% j6 V1 E! v6 x+ B# [actualwidth=ns_marquee.document.width. Y: o5 f1 u& G7 o! O2 N
}" J8 ^6 k/ R; `. r0 c( y9 U
lefttime=setInterval("scrollmarquee()",20)
; ?/ ?  ]. E, Z  U% H}
/ T0 [& d4 g. i- s$ K. X7 Ywindow.onload=populate
4 Q: v( u, x! O$ m7 z% i2 J' m& r1 H6 S
function scrollmarquee(){
5 h1 i0 u6 J* n! i1 Vif (iedom){4 M, P5 d, {: I, @9 {
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" z: B' C: w/ n& k( \7 M' l* O0 Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- d/ j4 ?- P* @' c
else& }4 j4 P3 N# f% x/ e
cross_marquee.style.left=marqueewidth+8
; s  \& [" H1 i% O+ a/ \' T7 c" ^" x+ ^4 C  A, j) h0 z
}# j/ t% r& K! n+ e
else if (document.layers){
( R  w# }; L: i/ h& t6 m8 rif (ns_marquee.left>(actualwidth*(-1)+8))- L3 x& M0 D+ d" V+ G$ ]
ns_marquee.left-=copyspeed
* N) p; L9 j( i: C5 F0 |else
5 U2 }6 D5 V9 E% w* j/ C) S. Ans_marquee.left=marqueewidth+8% w8 r, W: A) S! ]
}3 \9 N! ^. h; S1 L
}* m' C' J! a8 v! |% |( D, E7 I; Y
& ], B. f! ~  t- M8 |! c# x# ^
if (iedom||document.layers){" M3 A+ K: N( W) ]
with (document){& X4 t- a  f# ]/ M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); l( O1 Q" m6 c: `1 ]% c
if (iedom){
5 b  h/ c3 Y; s: `; J# H6 |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), w3 K  t+ Y) ~9 ^9 a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% B8 K: k9 m" P: ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 q1 d+ t+ y! N4 c7 b2 Jwrite('</div>')
4 Q: u1 B% H  r  c}/ L# |" X/ a# e9 C3 j5 s
else if (document.layers){, g% g) Q2 \6 p! V+ I. E# y5 B$ b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% O) B+ E3 ?' n8 ?9 H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 o: h& M" h6 N) [9 xwrite('</ilayer>')8 G6 d! P0 X1 r% k: L+ a2 K2 C
}0 v6 L; q1 ~, ^* B' O4 w9 N
document.write('</td></table>'); E5 r& H' R* v, _& G& L
}
( n4 O5 \, v5 m1 w& b6 ?}
- k# J0 O  R1 d' v1 d</script>

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