返回列表 发帖

网页之跑马灯文字特效

//修改宽度! u- V- i/ S3 w% O& H
var marqueewidth=300  U; m  `  B- @5 f: e2 v
//高度. [  W7 A8 w6 F
var marqueeheight=25
" w- H2 w$ D/ ~4 A( x# t//速度(1-10)
; k. ?) v+ U% Y1 a8 zvar marqueespeed=3
7 {+ c0 ~" [" N$ O//背景颜色
0 P6 ~; q9 P7 ?var marqueebgcolor="#FFFFFF"' V% i: k! g2 \% E
//是否能暂停 (0=no. 1=yes)?$ V5 N; v- F( u) i4 E5 C
var pauseit=1  d$ e( m# h, a# Y9 e) o6 X

1 R: f+ v: _6 n2 a//修改显示内容
/ M- m8 w$ h: b. Q4 lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' V7 p+ N$ n( p6 Y- i

- n, y6 H' `" R+ t# c% l* G
0 b3 N+ J2 L& N9 q0 `; @////下面不需改变////////////, t; e5 D* [/ u- u" o( l' v  t
" ]3 L8 I1 b- c
var copyspeed=marqueespeed* l, v; I3 Y2 G$ h! r
var pausespeed=(pauseit==0)? copyspeed: 0
/ m! T' s( h- ]var iedom=document.all||document.getElementById1 @: V' m5 @6 b4 e/ W( f% O
if (iedom)
5 y0 N, z( |* o' i1 H6 Bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: J, x% X4 J: ?* T) D# n6 @var actualwidth=''( |3 x8 C9 w" L; v5 u
var cross_marquee, ns_marquee
0 l- q/ J/ X1 K- E" ?' M, _% z
) B$ X% G( p5 j6 i; S* r% cfunction populate(){
+ ^# u+ T& r% V# ?+ S/ r" t( gif (iedom){
% v' D. O; y4 Z  ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, M, z2 Z) e4 X2 t
cross_marquee.style.left=marqueewidth+8
0 H2 L  f, o# `2 W6 z  jcross_marquee.innerHTML=marqueecontent5 Z: V/ N! q- G1 @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" }) t! Z  w. A$ i1 y2 R
}$ F1 l7 b, s: {
else if (document.layers){- p9 Y3 P+ F5 H! O2 M' s
ns_marquee=document.ns_marquee.document.ns_marquee2
) s  S5 t: g0 S  Dns_marquee.left=marqueewidth+8
5 c* j/ d4 y3 v% z6 Yns_marquee.document.write(marqueecontent)
* c2 b3 f: A* K' F! ons_marquee.document.close()2 W8 Q0 P7 A) U. \9 a. L
actualwidth=ns_marquee.document.width
9 Z- v: ^4 k* m; P7 t8 n}
9 X! }( X% y! m6 o) A% o6 y  elefttime=setInterval("scrollmarquee()",20)
, {1 Q* A1 t, _% s}
3 ?& O& u! @4 [  O1 wwindow.onload=populate0 U7 ]7 c6 A" z: \
$ D5 d9 I3 R/ \8 s4 x
function scrollmarquee(){
2 X% x% Q- v; r, m5 ?2 k/ y7 }if (iedom){
/ Q: k+ Z0 e* F+ _; rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ g3 E7 e, T/ m( H) h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 Q  {6 I& S- Welse2 h3 g2 ?) X% G% v, M% H
cross_marquee.style.left=marqueewidth+8
2 g  I0 z5 N/ s  i
4 O1 f6 G9 r9 ^* p, f}: ^9 ^4 O) |; q" ?8 R' @" F+ @
else if (document.layers){
1 ^; D. \* J* [" q% [7 Eif (ns_marquee.left>(actualwidth*(-1)+8)): ~6 x  ^! c3 a* ?7 g
ns_marquee.left-=copyspeed; F5 R2 |& O, I4 W2 u
else
2 _6 M2 a1 |/ Q, hns_marquee.left=marqueewidth+8$ b2 L. m3 C: j
}" D) t6 g# S% r* _: R5 V
}
/ v7 ^' w3 ]7 w7 X- Y- N9 n9 {3 T
if (iedom||document.layers){
% T, k7 h* v* nwith (document){
' L! ?0 T! e1 b. Sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# d" F' a: \7 \' F- ?
if (iedom){7 x  N( i3 o8 j" V0 P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& D7 o0 _9 r' P8 V; B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 j, Z0 H9 N( H9 Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) x8 i. i4 n- [# p; A# h( ~7 L0 ]
write('</div>')
6 ?3 M% ^/ @% a  K4 C9 _}; B. R  Y! }! t, U, Y) _
else if (document.layers){
6 E; D0 g; C) }2 o5 cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( ]3 u; t7 G& {2 _& n% Z' Q9 n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' ]* O/ q8 d: W- rwrite('</ilayer>')9 Z. N6 r8 s, e  D+ q
}7 }  t0 ^" r* N/ P5 {5 k- h3 `3 G
document.write('</td></table>')
5 V/ a7 w2 F# _; I* t, P( b}
8 v. C4 l! X. o: C- S1 l' `9 m% i}
; k5 b$ l- I1 `</script>

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