返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# N% B# z6 I, E7 w, bvar marqueewidth=3006 v# {  p7 R+ W0 N+ A* x$ A
//高度3 c4 l# D$ O9 l* p
var marqueeheight=25
/ u; U1 Z2 A) j$ Q4 d//速度(1-10)5 l8 d# k2 d, `
var marqueespeed=35 l7 z# M9 S# c9 _
//背景颜色7 k9 X  h/ C6 H* a" i* C9 j9 Q2 w  _
var marqueebgcolor="#FFFFFF"
- _+ L8 k* t2 R//是否能暂停 (0=no. 1=yes)?3 A6 D  O2 ?9 M% c, e$ `
var pauseit=1
- U6 Y) j- t+ x# u
* ]* I' V) T- W' B' ]2 X# D//修改显示内容
' t- ^, t3 M" X' P  Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% O$ ]9 x: |3 i& R3 t( O
5 w2 a) z1 f! \9 ]2 n+ m* g- r

6 W3 U1 i$ x1 L1 g; j- p  S/ C0 L////下面不需改变////////////
, f5 i% O* a, ?, @% z" S/ p. U6 n/ }% X" @+ [
var copyspeed=marqueespeed
; P9 x3 `* \  {- \/ e7 vvar pausespeed=(pauseit==0)? copyspeed: 0; Z5 D2 R! R" {
var iedom=document.all||document.getElementById
/ p+ O3 E! |" v7 S2 Q. oif (iedom)
8 \1 ~; Q- a% H( C# v# y8 edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 Q, X* }& ]4 l. dvar actualwidth=''
; n4 O  \+ S8 O- {var cross_marquee, ns_marquee
% x5 ~1 a. N! O* n0 V8 D2 Q% B
& \  x$ P/ {% A2 n9 ufunction populate(){- f: B2 ?! _2 ~  W' Y# S
if (iedom){
+ Q& z1 p" b, k# m- X# s; kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 R8 L* h8 x3 I- Y; \
cross_marquee.style.left=marqueewidth+8. ~, M/ |5 Y3 f6 _  Z3 ~/ i
cross_marquee.innerHTML=marqueecontent+ H$ W( p( e- s2 S- \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 K( d& k9 O3 F" |7 p, i: [}
5 c7 [1 x! }- _else if (document.layers){3 B: \7 [; ?3 t6 s' b, j% o) _- G
ns_marquee=document.ns_marquee.document.ns_marquee21 ~; G" b7 @* F
ns_marquee.left=marqueewidth+8
1 {% C' \/ H4 J( b* ~1 tns_marquee.document.write(marqueecontent)
) X+ Z( Z/ j( G' ]8 v! d: q% qns_marquee.document.close()# W4 G- H) @- G/ c; Z4 r) {
actualwidth=ns_marquee.document.width
2 q6 v: O( Y& h% s0 x: I' w' _8 f" i}- V; I: d  f4 U, f
lefttime=setInterval("scrollmarquee()",20)
6 F! l3 \0 f0 u- o}
4 L# h( p. U9 q4 Vwindow.onload=populate; e0 A6 s4 P/ O( j3 f# ~
( l: l2 w* v/ s! n0 g! Y
function scrollmarquee(){
1 F) B/ g' b+ a* S: _0 aif (iedom){! f; A7 {$ r. {& V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  N! \9 F! O' ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 Y# ^& H0 b% O; R& h" u. |2 |else
# x5 ~6 L8 z' ]' g# ]& l6 X. ]cross_marquee.style.left=marqueewidth+8) G; Y" e" q8 W7 x) q

) t, f. f4 x# h0 {5 b}
" ?+ F: f, _" g. o& S, l7 v. lelse if (document.layers){
2 a( V9 I" F$ w% {3 Iif (ns_marquee.left>(actualwidth*(-1)+8))# R) V, W/ m* V! ?- F  W; C4 ~3 S
ns_marquee.left-=copyspeed. H% @: U$ I6 o2 _5 Y) N, @& ~% w
else
! v: Y, \3 Z& }! ~, uns_marquee.left=marqueewidth+86 V) ^; N$ A8 g. r
}
, W+ H% k0 F- t3 A& a}
" ~5 J7 x" i7 P  F' i9 d, G
- f7 B/ o8 a: w4 E3 Q  d4 Uif (iedom||document.layers){
4 m" K* l- b& E; o% Awith (document){/ o2 t1 w" j5 Y& Y: C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( K; M" w+ s5 c- C
if (iedom){9 t" P& J8 K! d) J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 U9 C" [7 K" I! G7 c! H: R4 r- n8 u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! Y, |& v3 d# r& g  g* _5 n
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 R) M7 ~* L& t! Y5 T0 ^write('</div>')
% W, Q, g( Q3 V1 ]# O( d}
9 F, C( [$ l3 R2 u9 ]$ |else if (document.layers){/ d: U5 P: @: v9 P' j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  W+ K' L7 w) f! r: Z: l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" ~# |- ~7 ]- Ewrite('</ilayer>')
$ z3 S- D3 j0 n# }4 A}3 }0 l2 K/ R( C  O$ D% q* g
document.write('</td></table>')$ n7 g+ c# e1 @' Y2 _* q8 ?
}4 b; M% k4 H% o/ s! @1 [. X
}
" b! f* k* F4 ^" d</script>

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