返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# D% H% ?7 j% i. uvar marqueewidth=300
7 f& F) [. ]$ k; s% O1 o- F2 F//高度) ~: J2 |+ \+ |- @( c9 [
var marqueeheight=25
, G7 C8 t; y! `9 H% v//速度(1-10)3 p( f9 l. M, A
var marqueespeed=3
0 }- {, e, z: N2 e0 T% @//背景颜色0 v7 X# s- N8 H' Q
var marqueebgcolor="#FFFFFF"
  b5 {) U1 ~' H# @& b2 D1 n//是否能暂停 (0=no. 1=yes)?. N) G3 w. H7 e, h
var pauseit=1
: C0 z, h5 z6 q
, K  j3 [& z2 }" W. {//修改显示内容4 N1 l: W% H' A1 g' b! d, f( X, C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; j$ Q6 m; {5 h/ V* L: H* Z& ^" N$ d5 {) p

# a" q( q3 v' H4 z. |' e////下面不需改变////////////* z/ s/ m/ |* j+ r# }7 O/ S* h0 G

) Q* l( W0 Q8 nvar copyspeed=marqueespeed
$ \: t" v8 n2 M2 @; g* x9 g* I6 |var pausespeed=(pauseit==0)? copyspeed: 0- t  ~1 l) O2 T8 e" G
var iedom=document.all||document.getElementById4 y7 ?( b/ J. r& l
if (iedom)3 T' I& E, N+ w" i# s/ c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% w5 w" v" ^, [2 ?$ y
var actualwidth=''0 h4 J% Q3 h# ]/ @6 b3 x
var cross_marquee, ns_marquee) V9 p2 k8 V( d9 u: N
9 k% R5 ]( Y& X, w2 O
function populate(){
- V; ~1 H  I6 q' iif (iedom){
- i) `8 k2 E' @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' W1 a" n$ b) j# g0 O4 D! o' Xcross_marquee.style.left=marqueewidth+8
0 s! ]' y! N9 ~0 n+ z1 ycross_marquee.innerHTML=marqueecontent  i; V: ?( o. e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ o) z  {/ Q; ^5 @& A0 V+ r}; O) d7 v; t) ^: i1 T
else if (document.layers){
; f) D* G5 _$ J# J6 E$ kns_marquee=document.ns_marquee.document.ns_marquee24 ^: ~0 L6 g+ |$ X
ns_marquee.left=marqueewidth+8
) D1 }7 ^, J( W# D  i/ nns_marquee.document.write(marqueecontent)0 n& W; W) u9 H" c
ns_marquee.document.close()
& }- Y' y, x4 e+ eactualwidth=ns_marquee.document.width
: ?5 m: y0 c3 d6 t}
9 l/ M2 y" t) N0 {( E. Z+ Blefttime=setInterval("scrollmarquee()",20)( Y5 @( ?, c+ P) v9 l  B
}6 t1 O$ {- F( N. u7 p4 v2 u- h- s
window.onload=populate" J4 I8 P* `2 A. y* @
  w; v( d+ ^% Z( V4 y( O9 J
function scrollmarquee(){1 v3 _5 T0 r4 k( @" `
if (iedom){% P! z- @7 [/ g  A5 p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% E& X+ ^) R4 l4 }$ Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ R8 y6 C, c7 h3 k3 Y, W
else7 d' E6 U/ [' ^; u, v2 c
cross_marquee.style.left=marqueewidth+8
# \' o+ k0 l+ A: a) x, A3 l* T, l! v. C# b7 V0 P( x5 {1 R
}8 [/ t; F0 c: D( ]: u7 }! V; Q1 Y
else if (document.layers){
  O* a, b2 I5 e8 ~if (ns_marquee.left>(actualwidth*(-1)+8))" o, K2 V% x3 W7 D
ns_marquee.left-=copyspeed3 n4 D9 e2 g/ @; a; e' g
else
: ]# m, V  k. f/ v# ans_marquee.left=marqueewidth+8- b/ V( u$ I2 w! k
}1 s: S; x/ _1 w( N/ J0 @
}# R4 O$ M$ D5 _1 R! D

" c7 h3 G# ?! Aif (iedom||document.layers){; P2 Z9 q" \: c$ l2 ?1 H( J. v
with (document){/ I6 a! `/ V; V9 g; ?% N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 D3 z# y1 j% o1 @" N) S9 mif (iedom){5 B3 n, T6 g6 T3 h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). R) c( H& n# w) e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ d2 T" E" G" o  \$ D- Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 f4 N6 n: ~& }4 d" N: uwrite('</div>')
6 h" v% p; e! S# m+ `5 |}/ {2 W6 a, r% u# T6 @; i% G% J
else if (document.layers){
3 j' I' \, H' ?4 Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ I* r- M! N: t/ [" ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 F3 P/ [2 K: o1 o( O0 D( k1 pwrite('</ilayer>')
$ p2 s4 A8 t3 \- ?, e}! h2 T8 O9 _6 M0 J3 h
document.write('</td></table>')
- S& o) {, V/ @+ f8 ?, H  v0 l}, [) K5 f1 n7 ^; m
}7 |; t2 Q- K: r7 j
</script>

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