返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. \6 K- V) h. B2 g( u/ g2 tvar marqueewidth=300: ?9 g+ o2 D- w! x! ?9 r6 |3 P
//高度/ w7 r+ r$ F$ u. j
var marqueeheight=25  h: d8 @5 W' g4 C) U. V$ Q
//速度(1-10)" r9 i0 R3 w2 T: z; L8 J8 {- |
var marqueespeed=3% |; z+ G) A5 W; x
//背景颜色5 O- [9 b+ }0 q+ R5 P( Y5 U% V, C
var marqueebgcolor="#FFFFFF"$ M: `8 l& u6 |5 h+ `$ U8 @
//是否能暂停 (0=no. 1=yes)?8 d/ z' o3 I2 c: j6 r) z' f# R
var pauseit=10 d2 R$ e4 Y* {. z$ J, w6 T) _! h

* [6 D# {3 \5 C( ?# p1 X//修改显示内容2 {" c! ^& e- U# C0 q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ L+ ^% R& ?3 w4 {% u& e! X- A- _3 ^
' }" w5 ~" H- H# _! T0 U, O
- {$ X! ~) Z8 {8 W7 [) L+ m////下面不需改变////////////
, K* j# }( I/ L% B( D
5 W/ s- x8 w  Q9 j1 c! w0 wvar copyspeed=marqueespeed
0 x3 ~' G! y- y! X- C" m, ?7 xvar pausespeed=(pauseit==0)? copyspeed: 0; l8 ^& y% x8 L* \& @7 _9 w1 W
var iedom=document.all||document.getElementById
; S4 u0 v* O1 S* M2 A. n% oif (iedom)
8 T: |4 i6 b7 ^$ a; M) S* M  tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 K: V: n/ J* I- E* k+ A6 R* Zvar actualwidth=''
0 t: _. O$ M1 i" s6 fvar cross_marquee, ns_marquee1 A: ]( s& V4 N; n7 w8 D
- t( S" Z- t' L4 W8 I1 u5 k3 v# |
function populate(){+ b) Y+ ~' c0 v1 {. ]9 d7 I
if (iedom){
8 ], u: D, j- s; u. |0 O3 Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: H6 P) G0 u7 h" [+ P% ?* f9 e# Icross_marquee.style.left=marqueewidth+8$ N$ `: L* e# J% \' u& O9 `
cross_marquee.innerHTML=marqueecontent3 {9 |7 @& n/ ?) q$ C1 ]8 A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) N, @+ d  v5 m: W3 u' L
}9 T. l% }8 c4 k' i& h* G) @
else if (document.layers){- y+ Y8 w0 W7 @, h4 v
ns_marquee=document.ns_marquee.document.ns_marquee2* U2 `0 a& e- i0 n* k% {2 N# U- m
ns_marquee.left=marqueewidth+8
* y" M1 e6 p! h! m& e# f4 Ans_marquee.document.write(marqueecontent)5 B* z4 e+ z: h9 }
ns_marquee.document.close()
% I- b8 M: R: P& I: lactualwidth=ns_marquee.document.width! y7 X: t& {4 [' R, J
}
. l  w# t% Y3 M: y5 f8 klefttime=setInterval("scrollmarquee()",20)* N) L# b% [, d6 }
}2 ?! \" `' [4 C: y1 C9 u% ?! c  V
window.onload=populate( s" i3 a$ V, M! w6 w

2 T' D, J  C. ?- a; B* ?  v" mfunction scrollmarquee(){
: L; M9 C. Z3 W/ w& P8 qif (iedom){
0 N' m. e3 @* F* `4 qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% K- T; ]* \0 k& q2 Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 E. e* T2 j% X5 i5 m, T+ d- t: y
else
. |9 J: f/ |& j5 K+ P; ^6 gcross_marquee.style.left=marqueewidth+8
) m% H5 d6 S$ V: z  ]4 T& H: F4 z) T" H# H
}
% G% z6 ?* a0 G/ f  Belse if (document.layers){/ @/ d2 X/ V+ |$ X0 [
if (ns_marquee.left>(actualwidth*(-1)+8))
2 e. `4 x! D8 C( ^ns_marquee.left-=copyspeed
$ I3 {% K2 v8 T: z5 Selse3 _6 X2 k! f4 h' z- E
ns_marquee.left=marqueewidth+8
+ Y6 t! e* \! G}
% ]  M* o' p8 x+ O- J3 ]7 F}& l0 W  r# R- e  n1 H

5 c4 e4 F" I' _0 V0 wif (iedom||document.layers){
" Z- l) H- \3 W  D& H% I  gwith (document){
7 u: ~5 D/ d# S) \+ udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! T. r/ D7 T0 o5 I$ a, y8 v2 zif (iedom){
9 P0 A# _& o; v8 [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 `! k/ [3 z3 _. \9 j& u  hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 l# M( K8 n/ Q( @8 R  S1 n$ n5 dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ a# w1 |& l+ a7 e7 K" s
write('</div>')( q: G# H6 g& B# ^) x- v
}6 h& w4 D5 j) h4 w) k3 b8 k; t5 j0 q
else if (document.layers){
5 L# ?( n+ C. t9 l# w+ Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! b/ U! ]  s5 V% b& q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# h: D' d; O4 I+ V4 @write('</ilayer>')& @& f/ n/ t( H/ ?5 x- O) l; Y4 {
}1 @; D: }7 f9 A% B/ H1 z2 }
document.write('</td></table>')- b# I1 C( s0 ?% j3 F
}
7 f& B. `5 J" O8 b: ]$ w}; _7 B0 w$ W+ j, `0 l
</script>

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