返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: {* m$ U$ c2 z0 h$ Xvar marqueewidth=300
4 c& D8 \: t6 Y4 E//高度
' E$ H3 x- |% e9 h2 Dvar marqueeheight=25
) Z, M- B2 X0 j2 t. T; X) a: k//速度(1-10)# L, E% j9 F1 \
var marqueespeed=3, T, ?& K$ A/ `3 [! c
//背景颜色
2 r3 o* p6 Y$ `7 \8 ?* Ovar marqueebgcolor="#FFFFFF"$ l: d; P* S9 B$ d8 Y2 {3 O
//是否能暂停 (0=no. 1=yes)?  o, h, T  s, b" K5 T7 ?& T- M
var pauseit=12 W# `6 J( ?: ]) I

  l7 b5 R$ u  @8 T$ p: G7 y  i//修改显示内容
  n+ d: i% I% p, u! _' R& B& svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- {3 U0 j' \: t- k8 {. Y# d

6 g. J& b0 O1 M( @: m" e5 M" z
8 n% s' |: E0 k////下面不需改变////////////6 j$ @# w; C- J. Z

! H; T  [9 i  j: mvar copyspeed=marqueespeed  A5 [* ~. H  t' }
var pausespeed=(pauseit==0)? copyspeed: 0
6 P2 T3 B6 ?% S& ?  fvar iedom=document.all||document.getElementById
% [- R1 s* `$ O  `if (iedom)
+ N% x0 J: Z3 R9 M- S3 g8 xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& V/ R6 R$ m- n% l3 W- Dvar actualwidth=''
' Q: R0 ]# d4 n, t' avar cross_marquee, ns_marquee% S0 g+ v  Q% k; a- }

9 d/ a% ]+ d+ Y* p& n! V6 Tfunction populate(){+ q: r' I' C+ \! J
if (iedom){; t2 j) z; b2 C; D# @# Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 R/ H: K4 O3 Y+ j7 m# C
cross_marquee.style.left=marqueewidth+8, i# H7 a) M( i% x
cross_marquee.innerHTML=marqueecontent
- l8 ~- G! N$ u' F- Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' \; p4 |' a% B+ M}
1 a) H7 O. H; r' Z$ ?* \6 Jelse if (document.layers){' L/ l( }/ |; k+ o7 h0 F% |
ns_marquee=document.ns_marquee.document.ns_marquee2
% P6 v. z& |3 f8 uns_marquee.left=marqueewidth+8
9 ~# p) e9 A5 v& t4 H$ T* pns_marquee.document.write(marqueecontent)
' z" @- Y9 l' ?9 X8 o+ `0 t) \" ~ns_marquee.document.close()
* d& y9 Z4 I( N$ i1 C$ A6 zactualwidth=ns_marquee.document.width
0 P0 H+ N2 H& R2 y7 G* B6 |' z% J7 F}. q* X0 T- W: x+ _
lefttime=setInterval("scrollmarquee()",20)9 L, m- t7 P  ~& d9 J
}
7 J1 h% e! F" Q' z+ v8 ~window.onload=populate
* h- X1 a! `2 Z& F  M
8 z; }. X% C6 g6 e8 Dfunction scrollmarquee(){5 o& ~# k- i2 d8 C5 _8 w! u6 E" r
if (iedom){" N1 s1 {9 [" v& O/ ?8 g
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 t6 Q, g4 }9 O* r$ zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- e! E: b* ?% s/ A7 X+ O/ i
else
% h2 L* I" G% d$ B# V1 s) j0 f! tcross_marquee.style.left=marqueewidth+8
! s$ h! b4 t7 [7 i
: A7 u; ^6 X1 k& c# X# v}5 F3 N; K; w( O: _
else if (document.layers){
( ^9 b' h; t; m5 Dif (ns_marquee.left>(actualwidth*(-1)+8))
8 |* E, _1 T; B0 O/ e2 l1 K- z0 tns_marquee.left-=copyspeed* i2 M" G9 Q+ U# H- Y- Q6 X8 A/ o
else# X4 b3 U% `! H7 |
ns_marquee.left=marqueewidth+85 s/ s  w5 ~8 Y5 J' b1 ]
}
. y: y  |9 b3 n}3 k: [3 z. @) p( T! E% P! |

2 E* k0 D  W' I( N; N( G" Aif (iedom||document.layers){
* m  q) P* }3 |/ u0 n$ B! Vwith (document){
9 M' t! i& L+ }/ e! z/ k" I3 Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 h) d4 l/ i- M
if (iedom){
4 G% e8 l, `2 G& n. y/ u* uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). }& P7 C! k  R. y& @0 d" N* k; Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 ?: k5 T' |' y0 R+ U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 H) s; I) ^" N7 {write('</div>')
  G, l7 @8 R5 b$ }: Z; y5 H+ z% O}
7 P6 F5 f' d! N4 }& N; B/ Kelse if (document.layers){! B+ p' \9 h$ K) T  b" \* f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* p' z9 t% \  j+ o' swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- R# U& ~$ N0 s& f( g
write('</ilayer>')% x' {) v& d1 F! M7 |9 Z
}3 o: d8 B; U. k/ }: y
document.write('</td></table>')
5 \5 X8 C, @: i  G5 o0 j8 n}
5 l7 y7 T" z" L! W}* z8 I- i! M7 z- k# }+ i1 ?
</script>

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