返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 z  c- L' I" v
var marqueewidth=300$ N! Q3 c9 L6 z/ w
//高度0 T2 F0 K1 x7 _' \4 O' d3 _
var marqueeheight=25
, b+ a2 E- f4 U" v6 }6 V. ^) Q- u. [//速度(1-10)
6 q3 k2 V" v4 M( U# x0 U  ivar marqueespeed=32 r" x+ x, [8 B9 V; @8 e5 l
//背景颜色8 c& {9 [8 L3 w9 U
var marqueebgcolor="#FFFFFF"
/ t5 O. A* [8 p1 ]# |//是否能暂停 (0=no. 1=yes)?: E$ z" M6 s! G$ \
var pauseit=1
4 A( `5 J2 v+ G% k- \2 f- M$ R
5 d: a9 }7 V+ _; J, Q//修改显示内容
* Z/ _5 s' W, f; Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 s+ D8 a& Q# s: b' f2 f
2 ?; o4 F" n' C* t5 Q7 y  d; z. S% L9 A# g* O+ O9 ~+ O
////下面不需改变////////////8 k/ j3 k! Y& H$ z( v# t
8 q# U, f- x) F$ x3 X! W, U0 a& N
var copyspeed=marqueespeed
9 z( s; \. t, `8 jvar pausespeed=(pauseit==0)? copyspeed: 0
: S8 E- [. {* y6 @var iedom=document.all||document.getElementById
2 X, G! }# E+ `5 t8 j% u2 Mif (iedom)
4 K& \. D9 G( [/ l+ I! Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), W  R; r* m, J
var actualwidth=''
& t8 m' y; X" U+ h& ^var cross_marquee, ns_marquee
/ b& z8 |  N4 y" m' _) ]0 `4 ^8 h* S( ?* D4 ?9 S  Z5 o
function populate(){3 J' b( N: O$ E( c1 J# G# x
if (iedom){
. ~- y- e6 B- w& U# ?% W2 b$ ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: x4 Y* M4 z3 p0 a; U. Gcross_marquee.style.left=marqueewidth+8$ K: l. \4 X  B5 ~/ H* [, d$ [
cross_marquee.innerHTML=marqueecontent
  d: v2 U3 C6 g5 |1 aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 ~$ _% M* u  \- ~" k+ s}
- b7 {% z) X" ]+ P+ }8 ~1 n4 u1 a. gelse if (document.layers){$ t2 w6 N- W1 |6 `+ I& z% Q* _
ns_marquee=document.ns_marquee.document.ns_marquee22 J& L# }+ ?. v/ V8 I
ns_marquee.left=marqueewidth+8- U* H9 O, s. {+ G$ V
ns_marquee.document.write(marqueecontent)
+ M) e4 u0 Z& k' Uns_marquee.document.close()
. k3 {2 ~8 _& J3 v0 i4 ~* ], z5 _actualwidth=ns_marquee.document.width
. g' K; n2 T; z+ l& l}
, ~  [; F+ d  U1 \7 Wlefttime=setInterval("scrollmarquee()",20)% R( C2 }+ \, H4 W
}
! S- W$ u( ^1 s! cwindow.onload=populate+ s, G8 ~, F- Y0 y2 w) I
9 [' ~' }5 [9 ^: N; [5 s
function scrollmarquee(){' L( P0 N3 e  D$ t0 x" e$ B+ l! b
if (iedom){
8 \! G6 h% {- X+ J. dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): M) z; B6 v2 l9 M) e1 L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 D' j) k. V" L+ s% Qelse& h" A5 l7 _/ A, K2 y1 H/ s
cross_marquee.style.left=marqueewidth+8
, e1 Y) o" Y, g2 ~/ I$ ]- d  y+ h5 s# Y
}. c$ |: O+ s6 _- r4 \9 ?
else if (document.layers){% E/ D2 A8 E+ P. R1 ?
if (ns_marquee.left>(actualwidth*(-1)+8))
" \! x; B* Q- p, {ns_marquee.left-=copyspeed! E& q3 M- P2 {+ G0 o
else
& g5 P, V+ w5 W, Ins_marquee.left=marqueewidth+8
7 l: E5 V5 k5 l+ A/ j# k4 i% i}, _9 a7 S5 q9 X% F
}& l) b* G& A7 R. l9 e; f( f2 b
$ \0 p( H# e4 n
if (iedom||document.layers){! Y9 ~2 z+ A' p, M  A
with (document){' A* `# X8 y1 J9 J; S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( J4 y' ?7 F! L
if (iedom){
+ t  E3 M. \' ^' C) ?( ?3 d' ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 v) R: |4 z* v" |8 g: v4 j' Pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ O- p% k+ a6 a: ]& F1 Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 H. K+ f, j: t+ N+ m% twrite('</div>'), o6 d, q+ R( |. A) ~; _! H
}
& q, K- X: ?0 J; @& l  m; Felse if (document.layers){/ `; i  g$ @" Z$ X3 V2 s2 k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 }% A2 E( w! awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 ?' v: d1 S. `7 K9 ]1 D; Wwrite('</ilayer>')7 C4 J5 S* _3 S( O- h0 k3 s. T
}3 U4 Q7 K* t# w' X+ e
document.write('</td></table>')
' P3 q6 `8 k3 F& `}
2 ]% _1 c" y  q2 a6 E3 x}
" h2 N2 O, F7 C3 }3 h  s: E</script>

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