返回列表 发帖

网页之跑马灯文字特效

//修改宽度; I3 G  X; I5 C9 w8 V6 h8 }
var marqueewidth=300
4 g. @: \$ R3 m+ W) l+ Z1 D//高度
% O6 F" _! \$ e) ?var marqueeheight=25
0 q9 y+ R. K$ h6 g: ~//速度(1-10)
" r' l- C6 v% T0 C( J; I4 c: {var marqueespeed=3% ]0 I; J! w" c7 T6 {  }. I3 s
//背景颜色
+ r$ l, D! u/ t9 y$ b9 j; h9 ^& wvar marqueebgcolor="#FFFFFF"7 l3 M$ w+ S% M8 f' P' S- V  }; k/ ^4 U
//是否能暂停 (0=no. 1=yes)?/ N- D2 {7 b0 t! W4 c3 d! d+ @  s# v
var pauseit=18 a) ]$ P+ a$ `, T7 _

( k1 z- [* m. F8 k- E0 T//修改显示内容
; p  [% ?$ x# x9 ?1 X! I: tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 I$ |$ M. S; c5 {% N
' y- T6 v* z. h) d" F, u% S$ z
2 x1 c# v% l# G) @( R0 U0 A. I////下面不需改变////////////
) Y1 F  j& w. C0 g6 B2 m$ H( M3 a" I" a. ?5 ]
var copyspeed=marqueespeed1 k; E6 a; C) @! {
var pausespeed=(pauseit==0)? copyspeed: 0! K) l4 U" q, P* P
var iedom=document.all||document.getElementById2 V" F4 E0 M. d* _0 I) w
if (iedom)
) G- `/ e% c& S$ ^8 Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 E" Z, ~+ t% d$ mvar actualwidth=''
0 Z/ |7 d& K( q" Nvar cross_marquee, ns_marquee
8 z5 \4 H+ _$ j  t, _& l2 K0 N1 y; D: j# J5 M
function populate(){
- @( y0 O% O: X" ?. e" yif (iedom){6 N  O1 R# |0 [* G6 @9 e: R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- C! E* I/ X0 j7 f0 |% o
cross_marquee.style.left=marqueewidth+8
1 D% E9 `8 z& E0 Y: g6 Zcross_marquee.innerHTML=marqueecontent. S- o  l# b4 G9 p6 K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# U- s8 C7 D2 |( E9 q9 m* M
}
! _  t" B  F& T1 [+ \9 Xelse if (document.layers){) u( D3 y/ m5 I# C5 f  m
ns_marquee=document.ns_marquee.document.ns_marquee21 I+ R  G/ }' ^  d
ns_marquee.left=marqueewidth+8# V8 Z5 j$ a4 G9 }, F5 N
ns_marquee.document.write(marqueecontent)( _7 k7 O" I& f6 u! r+ k
ns_marquee.document.close(), ~0 j% Z3 K6 P# s2 s
actualwidth=ns_marquee.document.width
3 L* j& O" T6 R, N! B! ^}
6 w: L; b& i2 glefttime=setInterval("scrollmarquee()",20)
+ j0 E4 I+ E, R% u$ v( i- E}
3 U7 }. k. w2 b; F  awindow.onload=populate
) e; {( Q. m1 o  }+ ]' f( P' u5 R! U6 a6 Z9 U8 c! }$ Y( v
function scrollmarquee(){; C2 m' `& a2 f3 L" P5 ~7 n2 V
if (iedom){
, _; f! h3 `) B$ c. |: Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) R- R  X! O, d/ V1 F& \& R0 ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# k# X* V" \& Qelse/ m8 I" d0 _9 ]% Q5 B) I* ?
cross_marquee.style.left=marqueewidth+8
" H# y3 [6 |; Y. O$ a  c
  q" M. O3 X1 }! {% [/ w1 `* f$ ^, E}$ c5 G  V* x4 f4 |, {
else if (document.layers){
. V( q) @( B+ g" V) A+ o& f% m% Gif (ns_marquee.left>(actualwidth*(-1)+8)); U" d, b* G1 y8 a. j# i) }
ns_marquee.left-=copyspeed
) G# i8 a, A1 O1 B1 C8 c1 @else
4 }" i  q, _5 d2 x3 Z0 \1 zns_marquee.left=marqueewidth+8) K. O/ P$ A7 c3 K2 N
}  O/ s6 V! l4 R8 N/ i6 [' {: c
}7 {4 l0 _& L6 ]' [# l

1 ^5 S/ r8 Z* |( ^if (iedom||document.layers){5 n4 S5 s/ b2 ^. D
with (document){
0 Z. f5 ]5 W" C; edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 c0 v8 w8 t4 i4 Lif (iedom){! T8 G! ?$ a2 N! O1 V- X7 D, \
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# F) r2 [6 k# ^. D6 k- e2 T3 F' E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( Y' {" D/ n7 u; m, F) i; }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- k2 x8 j4 M0 G& _- q
write('</div>')8 a" m8 X; \) X! `, M$ U# j
}
4 @3 [& ?- Y5 O+ B- R0 Aelse if (document.layers){
9 B( V5 U2 G/ ?write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ W2 j! y# w  o2 mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& ^! ?4 [* v  gwrite('</ilayer>')
9 B7 k1 |% d6 x, u) E9 l, U! n* b. R}
5 ^6 ?0 K3 v3 A9 y! N- t. Y, \8 b: Q) }; @document.write('</td></table>')
+ n6 \& J. ~7 z' E/ v! i}
: ^6 x: ~8 L6 {# G$ T0 t}
" H# N6 ?7 S- U/ h! C- Y</script>

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