返回列表 发帖

网页之跑马灯文字特效

//修改宽度" ^' D( E3 K! N) ^! c
var marqueewidth=300
. V% ]+ ~% ]9 e) }  _& z' l0 p3 {; ?//高度
- X  O$ y4 l4 a* Pvar marqueeheight=257 L5 a9 T" E: C& x' k* C
//速度(1-10)4 r+ F" q  g9 j- K9 m* x4 o' E
var marqueespeed=32 z0 ~3 T) K5 n8 W; Z
//背景颜色
% [4 H4 w# K; p* X4 D* Evar marqueebgcolor="#FFFFFF"
2 W" q: _. o; }& q//是否能暂停 (0=no. 1=yes)?) Q) Q7 K+ L! J$ o6 Z9 w( a
var pauseit=1% J3 L6 x8 y: t; p
9 `" f0 r# k2 ^: F
//修改显示内容
' k0 M/ }, T3 n- r4 lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  w* m5 ]# w$ O. A) F3 g; Q- g0 v
0 _: r5 K4 f" y% ~% o  _* X8 }: O! |2 }& x7 M
////下面不需改变////////////+ J9 [0 L4 _) B! K

: t* s8 N" }; ?, Tvar copyspeed=marqueespeed
4 I- Z' K: H  S+ z6 zvar pausespeed=(pauseit==0)? copyspeed: 0
8 ]% o+ o$ ^. M+ P" ~( qvar iedom=document.all||document.getElementById
, e% l' d. ?0 `5 Q8 d: P+ K8 Mif (iedom)# }6 J" V+ |. {8 N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 H& x3 n2 \$ @var actualwidth=''
, _4 o- v4 a6 nvar cross_marquee, ns_marquee
% z# e' Z5 C0 F: N7 Q2 k' j/ E( A$ v  c/ ^
function populate(){
  g3 ]9 Z6 ^8 J  z/ zif (iedom){0 X) F1 v4 }+ g, c
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 ~6 ?# K% X7 n, k5 `( Y0 ]
cross_marquee.style.left=marqueewidth+80 r% |& w# K% k8 ^! k
cross_marquee.innerHTML=marqueecontent
/ N/ r' k3 H' Z. Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ D: I9 p6 d, @}
! @# E$ I# ^+ K6 Belse if (document.layers){
6 _0 u" `% c# M. Dns_marquee=document.ns_marquee.document.ns_marquee2
, E" z( V  _$ {ns_marquee.left=marqueewidth+8
1 M; P  R* a$ x* y3 X# \7 L4 Kns_marquee.document.write(marqueecontent)
* O4 T( Y: Z4 f- Yns_marquee.document.close()* A3 X# v4 l0 E9 E; W& p( D
actualwidth=ns_marquee.document.width
( `$ ]/ u. ?" ?7 M' ]) X0 X3 N7 w}
9 D$ a+ U$ K. |2 Xlefttime=setInterval("scrollmarquee()",20)- C/ u5 o) y6 i4 B& J
}
" F1 L  Z" k$ V; uwindow.onload=populate
* a/ o3 {6 w+ A) k! M" z: c0 f. q1 h9 c$ |, a7 a
function scrollmarquee(){
0 \3 C2 `6 O3 t2 u' ]; Cif (iedom){6 B$ e9 e4 }, N6 h8 F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 ~  y; ?: h+ c) i; R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( x) H8 e. f5 a6 z" }% f
else
' R! Q# \( [4 v' `4 D( @7 T0 i- Wcross_marquee.style.left=marqueewidth+8  n/ c, `9 C0 C$ x

# N) \: w9 W$ \7 D}5 |' R, J- |0 `+ D/ x/ b  h1 v7 U
else if (document.layers){
7 c6 w( C( G0 z3 b$ Dif (ns_marquee.left>(actualwidth*(-1)+8))
0 r) E. U, I! f: U1 u2 ~ns_marquee.left-=copyspeed
7 @; W; t" w5 a( Belse! U( H6 [# k$ n! K* U  J
ns_marquee.left=marqueewidth+88 ~4 V1 W3 a9 z2 R
}
' y  g$ V# d9 }1 N9 J' ^}
' _1 N6 E/ R  V- A
9 v# z' C$ ?( A. s$ K! o8 \if (iedom||document.layers){$ v: L: B: U2 J! f% D9 `5 {
with (document){
/ r/ b+ _& t% ~! P) D. O: e; Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 X  h, \: q( K# }
if (iedom){+ T; W0 ~7 [+ j9 R* V; j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  S1 T( @8 F! N. c8 k. [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; V+ P9 m" K( ^$ e6 W% F1 m4 ^0 rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 s8 J& O/ y, Z+ e) a+ g0 B
write('</div>')1 N( h1 |% K9 R
}
9 ?6 K; H2 J' H4 Y( L6 B# oelse if (document.layers){
) L/ d& M5 A" @2 b! Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 w/ P9 k( e4 j$ L+ a; j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. ^$ N" `, S$ Nwrite('</ilayer>')5 o9 h1 ?. C) t9 Y- J3 i
}
- z, u3 H' U  M- B' Z7 kdocument.write('</td></table>'). }- g! S8 v6 q
}
0 s" K) n3 {$ ]}
2 z+ \1 E9 Q" j" e6 u% Q* o$ D</script>

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