返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ l, V+ t9 y) {
var marqueewidth=300  u4 u% A) Y1 W
//高度8 j0 g7 m, A: b( @% B
var marqueeheight=25
6 z# s# A/ m& p7 ]$ E* n//速度(1-10)
  O' `9 m$ w  W0 T# [& `" Q* Svar marqueespeed=3
8 B4 G  X. v% B; E0 R7 c9 D1 }//背景颜色
  B3 D* Z& t3 H/ rvar marqueebgcolor="#FFFFFF"* C! L& h7 P5 Y" ?
//是否能暂停 (0=no. 1=yes)?  s+ @6 l+ ]* \* g. G' Z
var pauseit=1
. y3 r+ p) a( l" }' J  U& D5 o5 n  J7 \' H3 D! p5 \
//修改显示内容/ X+ ?! X4 h0 @/ Q9 P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ M. B3 I' t, U  C" Y( Y/ x  y

0 y1 V! g$ D; {( S& q4 `8 e- Y) L0 W# Y# I; T
////下面不需改变////////////  t- _" Q; ?- c& ~* r6 J5 W: b

$ I, g& b2 ?- K7 |. zvar copyspeed=marqueespeed" B6 T& I+ y$ y# U: T: d2 o
var pausespeed=(pauseit==0)? copyspeed: 00 X, n$ Q5 g3 o- x  ~
var iedom=document.all||document.getElementById
3 x* z& X3 M. J. W9 U5 h- dif (iedom)
9 r' m2 t, k; U' y3 adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 U9 S# {* W) `" `- @0 |& {5 Vvar actualwidth=''$ ~/ J+ v  }, D9 E, u
var cross_marquee, ns_marquee
9 l) G% L0 B2 C" P/ c+ _/ H" M7 y7 ^( n
function populate(){
4 r6 g) R6 L1 E) \; S5 a! e. cif (iedom){
- E  p! L/ u( U7 ?, L  X- J! ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! G; X! |: B9 }/ V2 m9 Xcross_marquee.style.left=marqueewidth+8
( o2 h6 M, v" |) d  j, Hcross_marquee.innerHTML=marqueecontent
' w6 h! Y9 i7 D  n7 @3 W/ C/ T$ [% vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 ^  A* w7 S% }+ {
}, P, W% z3 w. B7 q* w
else if (document.layers){
9 `1 j* V, ^9 yns_marquee=document.ns_marquee.document.ns_marquee2; E2 X$ y/ i" V) o: r# b
ns_marquee.left=marqueewidth+8
5 j2 F4 ^2 R2 t% ?ns_marquee.document.write(marqueecontent)3 k2 Z( T; y) X- `# k& G. V
ns_marquee.document.close(): W3 H; [4 v( {  N- r
actualwidth=ns_marquee.document.width# i, X) s) I2 N' b) i+ u: w' B
}/ G* n6 P; S" p) H* S; }
lefttime=setInterval("scrollmarquee()",20)
1 S6 }0 `7 V0 ^7 y2 }7 V: s}
1 I$ v9 `) B; P9 l/ j2 c4 Y+ Awindow.onload=populate
4 z! w# ~& @- [* c7 f8 e; p2 ~: q. J& p) M1 b
function scrollmarquee(){
& o- _$ j9 P  N0 Vif (iedom){6 i) O% a& P( M( I- N  f: t: g
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ T3 L) x/ H; c! p1 ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! R$ f; S' p3 f( ~. M' j0 T3 i# M
else3 T9 e6 |, |$ a$ G% a
cross_marquee.style.left=marqueewidth+82 Y4 t" b# j. K" u: |  B
7 i: J$ P- y2 f; X
}1 D, X* w. g; R5 P' M
else if (document.layers){
4 a) V# I+ b; l: @5 uif (ns_marquee.left>(actualwidth*(-1)+8))
0 J( y/ G  F2 a7 k5 I3 r% Rns_marquee.left-=copyspeed
5 |& H  `0 M3 g6 k8 D9 `else
, W& s3 A6 r/ }, j8 [ns_marquee.left=marqueewidth+8# [; ~$ F" P$ T$ }2 {5 z( O
}
  y+ o) a$ K  J! `& E}9 ?* r; W0 o& o# c0 G! n( `

) \0 B- j( q% I* f* y" eif (iedom||document.layers){" S: \# I4 N, [: _  p* r  G
with (document){
( E/ a: m, o8 c! S6 Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 q) ^  k, Z0 Y+ o7 D6 L
if (iedom){3 [. W7 |1 y* M) Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 u# W/ p1 X0 V3 o( C+ P+ V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ \. l2 E6 |1 |. ?7 H. g; dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), p# ~; V: n% R
write('</div>')
0 m+ U* W$ n, }}
7 H& u$ U- a& m5 D; x; h( ?else if (document.layers){* l9 h% F) ~: W. n; ?. j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ O: \1 m$ w2 A$ e' [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% A4 j0 ?% r/ ?. j# R; m- E; W; N0 uwrite('</ilayer>')
- e# S% B9 p- W8 R, Y3 q}
) v' B9 [# Q% _( _; bdocument.write('</td></table>')
, Z& K' C3 o. c; d$ q* P( j}
0 E% s# i& x4 g$ _}; H5 }/ @+ j+ @3 t; Y
</script>

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