返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! t& |; s* I8 |9 G8 yvar marqueewidth=300
$ o( x8 a! T. x, L& Z! a//高度
8 L! @) ~  n5 \7 v) y* y" h- @var marqueeheight=25
5 N4 x8 B( x, j. Y( s//速度(1-10)1 s7 n. l. F! W) M
var marqueespeed=3
, U" |) I1 }. ^2 P9 r# T! m//背景颜色
+ |( z. d! ?- |2 |- z$ j- v; S2 Mvar marqueebgcolor="#FFFFFF"
5 _4 W/ }( o/ G8 t+ h5 b/ L//是否能暂停 (0=no. 1=yes)?
: c' b, j$ N9 [var pauseit=19 O8 [$ ]$ n: T8 S

$ N, M) F! R4 N1 y1 R/ p! e' U//修改显示内容
6 i  L' a" X9 J; y9 _var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% M, N: g. f, D
( h+ d4 |; e. s! U& J

5 _' J5 S0 P$ N2 }////下面不需改变////////////
/ ^: D( s7 B9 N9 {: _7 f4 ]4 }1 z
var copyspeed=marqueespeed
, S4 C7 T& u1 l& u4 w0 cvar pausespeed=(pauseit==0)? copyspeed: 0# E8 Y. ]: S3 b; y
var iedom=document.all||document.getElementById
5 o  J% ^+ ^) Z4 ^& Z- ^if (iedom)& e! I& k; y/ b9 g) C+ M5 R' j* Y0 G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ j! x( @9 h% L& Z$ n* J0 M
var actualwidth=''5 ^) V) l8 Z4 j: v) E5 B
var cross_marquee, ns_marquee6 Z" E  g  A: p  W
( n' B5 u/ G: @7 v; }8 `
function populate(){
/ B, |9 k; f7 i# S% z% ]- cif (iedom){8 E5 i& H1 V* U- w1 b2 o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 [) [) n, W: ]! h; Bcross_marquee.style.left=marqueewidth+87 I& q7 u% `* ?+ e3 s5 S
cross_marquee.innerHTML=marqueecontent- i( M7 z% ?. o5 L( d) t# a! o+ b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 ~. `; ^. F2 G! Z) h0 v}
( x7 b. x$ b+ Delse if (document.layers){7 Q9 k# i, s" o* n3 `
ns_marquee=document.ns_marquee.document.ns_marquee2% a& a6 y  ]- _" f" h; x
ns_marquee.left=marqueewidth+8) t9 O8 u0 r5 [+ L. t
ns_marquee.document.write(marqueecontent)
# e. [; M3 x" H1 \& L7 u% _ns_marquee.document.close()& N/ u4 d4 x( z' M7 ]. m& y  t2 o
actualwidth=ns_marquee.document.width
/ u! g/ E% G3 }}. }' b$ Z( O9 ?' q# D. k
lefttime=setInterval("scrollmarquee()",20)
7 Y  E) ]  q# @: R}
3 x. y1 d  y. p/ \window.onload=populate
" `; V; e6 D) R% n
! V1 u% u: R7 z" y* Q6 ^function scrollmarquee(){
7 w2 S' ?" Z3 Gif (iedom){" `0 Z5 A$ O5 B6 M4 X- ^  Z/ P# v
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" ~) z- }; D; I+ c8 b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, u0 M7 L  }6 b! W$ L& B0 @else0 H6 O' |) ^7 N, `  n- y+ I
cross_marquee.style.left=marqueewidth+8
8 M* E+ ?; o3 N) p$ \& l* P  u& f" a) _1 i  b* t1 y0 s4 ~' U  x9 `7 B: G6 G
}
, M, l+ z8 T0 Y' J& p% jelse if (document.layers){6 ^" E/ c3 l9 q
if (ns_marquee.left>(actualwidth*(-1)+8))0 ?4 W5 o0 e: @& d
ns_marquee.left-=copyspeed/ m9 m  M. |4 [( Y9 h: }- P
else
7 j* D! P1 `0 ]8 H' cns_marquee.left=marqueewidth+82 _6 y: o/ x! F7 A( `5 J
}) Y5 E4 g' t0 ^2 {& z: ?
}" g* u$ X, Z3 t* O6 e
3 f# J8 ?4 N1 D  W7 y+ k7 U
if (iedom||document.layers){; I3 Y. A: [( U% B
with (document){* @0 n' q2 p2 E; v9 M$ p9 Q2 B5 G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 z2 b8 u+ _8 Uif (iedom){# v$ Q) B: ]4 V$ O0 v/ i
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 B9 R, p* k# `  A6 |, |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 X* y* a' p7 \2 Iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ g. X) E+ i3 s* o3 G. x
write('</div>')7 \' h) M' O+ W" [/ i9 t
}
9 n; G2 b2 ~: ^; qelse if (document.layers){; N+ t" D; I- C- P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 j" T. M8 t3 C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 B( ^5 `0 [3 p4 l/ n2 Twrite('</ilayer>')- ^1 e6 e8 k# |! l6 ~; ]
}" V. K" ?  ?5 E6 a
document.write('</td></table>')
9 n8 v& G( I2 Z}
- }8 `* E' n; w1 [8 t; \1 A8 E3 y}
5 X) P4 |: |+ L) I  {5 z</script>

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