返回列表 发帖

网页之跑马灯文字特效

//修改宽度  X% K8 g  m3 J  ^4 y% Z3 B
var marqueewidth=300
- W: C* c0 h: H  P7 b//高度) b/ p% f+ ^- Z; s1 ^( \
var marqueeheight=25
* H8 ]# y; D( x2 ]0 }' b//速度(1-10)% t: E: N8 f* `& m. M! F+ Y# t
var marqueespeed=3! v. K& ~! n1 G, j  q" M+ }, ~3 d* q# j
//背景颜色
5 C, j2 f( ?- T& T, Bvar marqueebgcolor="#FFFFFF"
" B7 L; |- y5 l. p, r//是否能暂停 (0=no. 1=yes)?2 D9 r! q$ j7 M' |$ Z  x# p
var pauseit=1* B1 R( E3 _% h4 Y  Y
# ~4 N) v6 G. |0 i$ A
//修改显示内容
0 q: g% d" Y0 z* {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% k2 b5 N; L( ]* K, t, _1 J! Z$ W9 m. b5 r

! @+ }6 r0 A8 ~! B& K////下面不需改变////////////
# K1 b+ D& r' W, Q9 ~) j4 T$ I
; K. z3 `" h* Y2 w. ?( E' Zvar copyspeed=marqueespeed
7 _* g/ ?  k& ]3 g, s$ L, Kvar pausespeed=(pauseit==0)? copyspeed: 0  y% i* }% P! u  y! x( i
var iedom=document.all||document.getElementById
' ~$ }& e. ?2 b! H% g3 u/ Wif (iedom)
- M4 b2 O5 {# F/ L: Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ e5 J3 u' M% t' O# s3 p  q
var actualwidth=''
" `7 n8 \' y/ |/ evar cross_marquee, ns_marquee
# `6 q" l$ _- U* c2 u, |$ V+ Z* g1 l) c9 j: q3 a
function populate(){. \, E2 W* r! g  x& Q
if (iedom){
, k  c; X" J7 V3 Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 d0 Z; f1 a6 v6 B0 d! B
cross_marquee.style.left=marqueewidth+87 c9 ^; g7 t: }7 z; @
cross_marquee.innerHTML=marqueecontent
0 w0 a& `, [1 l  Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 e7 f- _7 y" m' g+ E; e) H3 z
}- i; B) Z+ E- B+ ]2 r  G
else if (document.layers){0 E, d6 }, J/ c. C' u  {2 T' d7 `
ns_marquee=document.ns_marquee.document.ns_marquee2# e( s; `" E1 I0 N- M$ R) E1 Z
ns_marquee.left=marqueewidth+8
2 ]0 B3 M6 J4 o7 d* s! cns_marquee.document.write(marqueecontent)& C0 t3 U! G3 k6 @$ N( E
ns_marquee.document.close()
$ k+ b0 C' w) Gactualwidth=ns_marquee.document.width3 d2 _( ~2 c% B9 N7 Q% E. ^0 T
}
% o- w3 ?' L3 [4 k/ P' nlefttime=setInterval("scrollmarquee()",20)
2 [* Z( a( s1 S3 h9 r}" C9 z7 m+ [+ x! L2 {: {2 v6 B
window.onload=populate
8 e8 T8 n4 r6 S* f
) t! M6 [8 r  d6 xfunction scrollmarquee(){7 r7 _+ a) q% a% T" C" Q  s9 G3 Y
if (iedom){
9 W( _; U' D0 i4 R2 R; C. K$ C, r) C  zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; Q5 x6 n8 e9 Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 {, c6 ]4 d: H4 U8 Ielse
: A' j+ n4 m* B. d7 p+ e# Ccross_marquee.style.left=marqueewidth+8
! w; ^: d9 N0 e+ h  G3 Z6 j
1 k( O4 o: o1 Q}
: c$ j4 X+ b1 }5 ]4 ]  melse if (document.layers){
. O, e9 e9 \' q: |, bif (ns_marquee.left>(actualwidth*(-1)+8))2 m$ d: C& N9 l: O! P) F1 j
ns_marquee.left-=copyspeed
+ l& h( Y; L- x4 ~else
- Y+ b/ S5 F5 |4 F4 B- bns_marquee.left=marqueewidth+8
2 T0 q* b2 j" \}
2 X- B! T; g0 \  q, E) B/ U7 K}
* ~! x; g& `9 x* k% U' E$ \. t/ k. D6 |+ e
if (iedom||document.layers){" N5 g" J# J% a6 [, d$ N
with (document){
3 q* ?  y6 C" }- Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" {! C6 T) A4 ^  M
if (iedom){4 R8 g6 B( |1 ]6 G/ o$ L% r
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! _. s1 t. o; k7 y& V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ J/ h3 i" h. a: z8 d. Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ K) E( D3 Z( z1 L( W- ?
write('</div>')
% O# G. q; ?, j: E# }2 T}
  ^& _$ T0 r2 }0 R6 Uelse if (document.layers){+ N+ F+ j$ J4 J, y; ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  v# U/ g6 i2 _" e. m6 F; Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) Y+ q" O! A0 p6 S
write('</ilayer>')
& c5 Q: B( ^7 k! ^* v9 g* U}- X6 ?, u  l& D  @
document.write('</td></table>')1 o/ g  F. C* v$ F. H# n
}
. a, R2 z+ C" y# Q! ~}/ a4 J& b, Z+ }$ j8 [
</script>

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