返回列表 发帖

网页之跑马灯文字特效

//修改宽度& p7 l3 g" n$ L" }: B4 d
var marqueewidth=300/ c: {! m; Z7 R+ G1 \/ [& S
//高度
8 `2 W% B7 ?0 W. J1 Q# U' A) qvar marqueeheight=25
6 \; i1 i: V/ i3 p( T//速度(1-10)
: j4 [3 T5 v! w) w0 kvar marqueespeed=3
: H, a  M2 n4 N9 U: x/ O) J//背景颜色
2 W. P. h% Z& d9 y9 d7 hvar marqueebgcolor="#FFFFFF"
0 `" S0 F: l+ S//是否能暂停 (0=no. 1=yes)?8 E! g' m7 {& o; S  v
var pauseit=1
/ w" s  `5 C9 R1 h3 L( o& `; {* c# V7 V! N+ a7 g
//修改显示内容
4 w2 `3 w- V, h0 W4 Z6 Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: k" ~7 C* P* o8 R' _- m, Q5 x2 @: P  V% X7 A) q

3 R% B* t' Y& H3 T6 C" F////下面不需改变////////////2 K: x7 j3 p6 `4 c

4 E0 K! Q8 {- N5 n7 P4 b2 L7 Z0 evar copyspeed=marqueespeed
- A. V, n7 q1 C5 s* Zvar pausespeed=(pauseit==0)? copyspeed: 0  D! L+ M, q$ W! r
var iedom=document.all||document.getElementById
" I/ M: _( p, e2 ^if (iedom)1 ?( f- `: l% F0 I7 v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 I. h6 |! ~8 a# a; i; B
var actualwidth=''
6 u$ {& U3 v9 a% M) P% cvar cross_marquee, ns_marquee
6 q6 z; x  _* ~9 e' F+ E+ b: h$ x0 o; ?. [
function populate(){8 A  L7 V8 v! [# b
if (iedom){
) X  U0 q$ l" r  b: m; dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 P- b- I- Z7 ~$ K2 Y; C& R
cross_marquee.style.left=marqueewidth+8* ]' h, F. {6 ^4 M; G
cross_marquee.innerHTML=marqueecontent
$ U% k( t1 u4 y+ t8 Z5 @. Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 V3 W4 r: K' x- l}; G, p3 F/ c# C8 e8 H) T3 A4 t+ j5 n9 `
else if (document.layers){* d1 g& |& W2 y6 I+ a8 y& H! p
ns_marquee=document.ns_marquee.document.ns_marquee2( \' \" h; e5 s% X" R
ns_marquee.left=marqueewidth+8* N2 ~  {! ~! q: _& b
ns_marquee.document.write(marqueecontent)
$ F, A; {$ Y5 G8 vns_marquee.document.close()
, D1 H" r  t& s* ^" |% v9 \+ `actualwidth=ns_marquee.document.width3 G, J1 P; o. Q) |) P
}
$ k, ]0 @$ T: Plefttime=setInterval("scrollmarquee()",20)6 r( Q& {8 }, V
}
( \5 y) _% O$ S$ K2 h& Rwindow.onload=populate
3 P/ D; F' q, M2 G% u3 \8 Y2 [: s1 x) L; s0 _* _# L
function scrollmarquee(){' E3 r: i  Z* h7 h; F& G8 @
if (iedom){8 `3 z: l3 \3 |+ R% E* Z  f% u6 q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! v' q7 l: t1 a  L+ Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 z. C7 V! ~" ]" ?, relse2 o& M8 \& U* v8 w  l$ Q* x. t; S
cross_marquee.style.left=marqueewidth+8
* T! g) K  P# Y3 O9 W& r2 C" j9 D* u+ N9 Q  [' X, F$ i
}
5 K* U. s" u6 f: j! Yelse if (document.layers){+ }3 r5 q* s" b# ^
if (ns_marquee.left>(actualwidth*(-1)+8))
" L- x2 B( @, uns_marquee.left-=copyspeed/ o6 m2 Z, x" ^, Z4 v% n
else/ }: V  i( D- A' a! P0 `7 [
ns_marquee.left=marqueewidth+8
6 |. i/ ~7 j/ f4 }7 Z}- p$ b1 ~! p: Z, D7 t& J. ?
}; P( _* k! {! C& P3 ]8 P7 v

' g1 A' e7 r- J. c2 vif (iedom||document.layers){# L& E' |" g3 U' S6 ~5 b; t( w3 o2 c
with (document){/ b6 Y/ \7 g0 M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 b; }; }  e. p5 u* c' V
if (iedom){8 t' U% j. t+ \6 n/ p1 k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 o2 q% ?( X, {3 P' H0 s. b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 C+ u  ~$ l  Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 Y: A) _. ?3 b0 ?9 a, j* r
write('</div>')5 q# f# {  H8 E2 b! b& F. X" \
}
. ~2 Y$ P6 y& i0 X8 O% z* X6 Velse if (document.layers){. A+ R, t/ y! D- w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). h5 R8 p. J) N9 d7 z0 o9 v
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ x4 a+ M, t. W! f
write('</ilayer>')
! H+ j+ V* a% d/ f; z6 t) R: M4 [}: f$ G! f9 |( |/ x0 d2 Z3 T+ [# j, o  z
document.write('</td></table>')
- D& \0 P% B) g* d+ X5 t  _1 v}
! ^% b2 `* x8 }( G1 i; r) N% ]  T( R}
+ j6 S0 O) N- X+ M& o6 V</script>

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