返回列表 发帖

网页之跑马灯文字特效

//修改宽度* g* G: R9 e/ G: E  e, m9 @" K
var marqueewidth=300
; q4 |4 M; c0 d2 M& {//高度
' h/ n  _6 z, ?/ tvar marqueeheight=25* J% O: ]- v5 w( R6 `* d' W  E
//速度(1-10)
* x) |# w; v4 ivar marqueespeed=3
, `9 R* `1 C/ q/ C8 |! k8 \& W, Q//背景颜色
2 P/ h1 z1 v! N( O3 b- C  |8 _6 ovar marqueebgcolor="#FFFFFF"( O. j1 V0 z: s1 j7 @
//是否能暂停 (0=no. 1=yes)?1 P1 T9 h& u( L6 a
var pauseit=1% n! Y! @' [! M. x1 g

) p- |, ?# L/ ~: k, r3 S) d2 Z//修改显示内容& f) g2 |% i9 Q2 u, R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ L3 Y& ]$ H9 ]8 x: c" q0 z" j
5 b4 b1 p( s: i, [+ U

" p% q; `7 {$ w- Y' _////下面不需改变////////////
  @# C1 @# \  v+ L3 E0 m5 |8 S% V$ f, w2 h9 I3 Y! H
var copyspeed=marqueespeed
' D" V6 {) G! ~, g" N" ~var pausespeed=(pauseit==0)? copyspeed: 01 N% o/ I/ g2 r
var iedom=document.all||document.getElementById
- j9 w" v+ r) L' i0 j2 |4 Iif (iedom)
0 v5 z1 V. O2 C" o2 fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- f4 D3 h% K" ]var actualwidth=''5 |. F' J6 B% C  f
var cross_marquee, ns_marquee
" w6 @! I) r* Y+ }: \5 V! d. _) p0 Y. L. h) h& s  s- N
function populate(){
9 N7 P! e% f7 {1 }" B0 Y* N. wif (iedom){: N( f" C/ P% j; m# V: K) g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# I  H( z& Q1 v7 v& t: g
cross_marquee.style.left=marqueewidth+8( T/ M& \, @/ h/ P7 }
cross_marquee.innerHTML=marqueecontent
  j' ~0 h, @& B, D' vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) N% O2 ?/ g$ w* [- l  d  u) L  x; E- m}
- U; N  ~' Y5 l- B, E" S( \, h6 Selse if (document.layers){7 |$ }, B- ?1 ]4 }* `$ F" D4 f
ns_marquee=document.ns_marquee.document.ns_marquee23 ^8 Z6 {3 m. f9 H; D1 E. M+ ~6 U
ns_marquee.left=marqueewidth+88 Y6 U2 f7 R1 I& D4 B* d1 r/ a
ns_marquee.document.write(marqueecontent)- p$ @, J2 ]' u% O' E
ns_marquee.document.close()' U3 y# Q( o; [
actualwidth=ns_marquee.document.width& L1 f4 B9 c- v& L7 C3 m$ n$ C3 ]
}' T. D* L7 S' [
lefttime=setInterval("scrollmarquee()",20)$ l) e; F* c9 q2 J6 A; I. {- w
}; C7 I. n# S- V6 [
window.onload=populate
, `. `4 m3 a* w/ q. `
: ]  I+ k. \4 N% I) E# ?  c, ofunction scrollmarquee(){5 T1 @! Y/ j7 C* T( |
if (iedom){5 [* @# w% ]" j8 d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 ~) Z( c! s4 q+ s0 R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 x0 z: T: Z9 C* `: y# I3 A
else0 i+ M5 X5 K8 ~- S; M+ t0 h
cross_marquee.style.left=marqueewidth+8
! U8 _: g# o* q5 `* X) t2 b  l
7 x3 q# x. G' x( ?6 H# ]}
$ \8 @6 O' l# b) c' B+ Jelse if (document.layers){
9 `& g. h5 |: l" Eif (ns_marquee.left>(actualwidth*(-1)+8))
1 u. K. @. u! {' K; R: n# T1 }ns_marquee.left-=copyspeed
+ T  x$ X7 x) W; Relse1 P6 E4 x/ J' |5 F! c. V
ns_marquee.left=marqueewidth+8  U8 W# p  g; X( u! L
}
: y" G6 X/ h- n7 m1 n}
" l" W3 ?4 b1 @: h
: S$ w0 H  I: nif (iedom||document.layers){
; x6 X# z% G0 r, u9 o7 {4 }/ h( nwith (document){: Z9 O2 P/ M# l" H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 ]7 [# G: ~5 o: E2 q
if (iedom){
7 `, F  g! W# k4 fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: M* E% R9 N$ N+ K+ o5 p  {! nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* e$ e# _7 z5 j/ O4 t; F& I
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: T( q) a7 s+ Ywrite('</div>')1 B  s4 W. {2 [
}! c2 T  ~. k* N
else if (document.layers){! d& C" P" ]) h8 K7 y5 r
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- B! o3 p9 h( [. W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 S' j9 q( A1 A* s  |, {3 owrite('</ilayer>')! h0 \4 m+ t% }( R
}: y& V6 o+ j2 z# j! p8 v( U
document.write('</td></table>')- |6 P( j0 [- q# A, D: |
}
2 k: ^5 Z: N' D8 ^}
' d9 w0 T) @7 ^. x2 M</script>

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