返回列表 发帖

网页之跑马灯文字特效

//修改宽度; u+ r+ y  \( p5 m) d  n# _3 P
var marqueewidth=300
; q& P7 Y# t: r# V//高度
. z% V; y  \- m0 Xvar marqueeheight=25
! u9 g9 [, b1 Q% F, e/ \* w, s//速度(1-10)
! P- t: N2 Q  [* ~* ~7 Cvar marqueespeed=38 H' I  e1 t# F2 F
//背景颜色
' ^, g+ z4 S: Fvar marqueebgcolor="#FFFFFF"
& x! e  g2 _/ N. j//是否能暂停 (0=no. 1=yes)?! F1 d  Q0 V5 P5 A; Y* [* v7 w
var pauseit=1% \1 Z0 h7 Q( g- w* Q6 u
" A/ b% ^( ~' P/ F5 }
//修改显示内容2 Y. C1 ^6 X! ?, d6 Y4 v( P9 K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ y! g6 n( c1 _8 b
: U8 M- D6 Y6 \; ]) Q/ n2 _$ W8 w. k8 M7 y) |
////下面不需改变////////////' _) a* _# F) S0 n2 c
0 y' M9 T& L5 C# L) d
var copyspeed=marqueespeed8 Y. o0 z+ c. i
var pausespeed=(pauseit==0)? copyspeed: 0
' Z7 l  s; }6 t* z) N5 Evar iedom=document.all||document.getElementById% a3 x+ j* @" b
if (iedom)% E6 i" h1 Y' |- e3 D* L. x0 r
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ a8 i8 j6 g5 I9 _5 @" K. d+ O6 Tvar actualwidth=''
, r+ N! }6 d, f8 ovar cross_marquee, ns_marquee) Z. s- P7 ?& g9 k

  b) q0 q( e# W' v& c1 kfunction populate(){% s  D0 q- D1 F. f- ?. O1 Q
if (iedom){3 G/ j  v0 H' ]0 @7 y, O5 Z3 j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* B$ P3 a+ W% F) lcross_marquee.style.left=marqueewidth+8
- O6 I& e. ?! xcross_marquee.innerHTML=marqueecontent2 E8 J% [$ I: W. [
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) F% F- }6 _: i8 z2 [}
/ J4 k; U7 ]: |else if (document.layers){% t' W3 u& A- Q, @  \% P
ns_marquee=document.ns_marquee.document.ns_marquee2! h, A8 k: ]( o) k6 b
ns_marquee.left=marqueewidth+8
* r, y' _$ l' _. {. k7 z6 Lns_marquee.document.write(marqueecontent)  a7 k2 Q$ @/ I+ A/ l7 h
ns_marquee.document.close()
3 b: [7 _; c/ ~, U. A# ?6 S4 T) Nactualwidth=ns_marquee.document.width* B* d8 M6 K; @& L8 J: K# N' w" d% s! a
}# J& z( B0 j/ K
lefttime=setInterval("scrollmarquee()",20)6 V; p) K& m6 O0 d5 H
}; ]- d4 P& P& m- G
window.onload=populate& Y& L5 E( n1 h9 v  p  Q4 H6 g
! \! m" g' w. X2 [5 |; D3 h! K
function scrollmarquee(){7 ^" p2 r# v4 h5 `/ U2 r. T- M
if (iedom){. l* @6 f1 K! ^+ _& m7 A3 B
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, \, L) R4 g9 [2 [+ bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* {- G- C& i$ i0 B
else
! b0 a; ?( K$ N0 D0 [cross_marquee.style.left=marqueewidth+8
- o: f1 e7 q0 c' ^3 ~& ], F4 ~, K  n; X8 g
}4 A9 ^2 }7 G) Q% A8 u
else if (document.layers){
& G0 |$ T+ c/ i( V7 Z* ]0 Y4 fif (ns_marquee.left>(actualwidth*(-1)+8))
; z/ o' Y5 }% w3 nns_marquee.left-=copyspeed$ ]6 D* s$ q1 S# c
else# s1 s7 B5 V' \7 M: ]* V
ns_marquee.left=marqueewidth+8# h- `3 h4 e  ?5 j
}: D2 s0 n* n% j& B/ u) ^
}( M3 P7 a& h9 [2 x! ]0 X4 E* G
- P  h' a/ ~+ ?$ f
if (iedom||document.layers){0 P' O6 p% @1 ?1 q* a
with (document){
% V+ y/ p4 S2 I% z: O/ C* Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ s+ @- r" q; }2 U% q2 c* L1 l0 E
if (iedom){
& c9 ^) a# x3 l  F  t/ \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' l+ X. ^, B- r5 u9 E7 ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 w4 r$ ]& ?9 R: N$ y5 \) ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' j. ?  K( [% i9 _write('</div>')
, T! |3 x# i" {& {% E7 U+ I}
( u4 R( M* F9 O; C! n: F: \else if (document.layers){' G: p2 a: |) x6 n; d2 E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! s! v% e2 |3 L* g0 f; R  }7 F7 Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 d1 s9 H( G5 r# X) W! j- K2 Qwrite('</ilayer>')
+ T! D7 K+ t) C) W+ E}
8 ~' s1 s! |: I5 y0 `document.write('</td></table>')/ b5 J+ N7 y4 L8 V& ]8 g( h  e
}
1 |- z8 v" ~/ C, d. v: P; h}9 K' p) e1 c0 C9 s% W+ a- h( X! D
</script>

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