返回列表 发帖

网页之跑马灯文字特效

//修改宽度* o/ q1 U: S' A3 t: n5 M1 P6 W4 r
var marqueewidth=300
, |& o# Z. z! d, N//高度
2 w+ q5 j  O" L; |" I- ~: gvar marqueeheight=25/ ^; q5 ^8 }7 Z6 p% E
//速度(1-10)# M/ a8 m3 t  _% q% v: x. |
var marqueespeed=3  T( j8 ?. m, a  @" h6 Y
//背景颜色
7 I7 l: X' D3 x# Y- Gvar marqueebgcolor="#FFFFFF"
$ T( W1 ]7 \7 k0 M7 q& N//是否能暂停 (0=no. 1=yes)?
% ~* \! `8 [6 @0 W( H+ Pvar pauseit=1, |  O9 F) v9 @6 s1 i1 o* x

% }: s- W# G& |/ y4 i) Z6 t//修改显示内容
- t5 o& ~+ X( \  y- Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! F/ V2 r* Q" `& D, P# z5 O5 u8 z  p& G: Y; e
3 P' ]( R/ s' U; @% F! x
////下面不需改变////////////
5 s& {. e  n- I8 e2 G  _
1 f, v3 e! S! N3 mvar copyspeed=marqueespeed0 {) V" o/ h+ a& J! X+ j0 l# Z
var pausespeed=(pauseit==0)? copyspeed: 0
) S  ]1 g- @0 j$ k6 |' qvar iedom=document.all||document.getElementById
2 F* r6 H4 W6 z  ]% S5 A9 tif (iedom)
* q7 P$ l2 [8 a! m# s7 t) _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( K4 x8 ~2 T; B! ?2 xvar actualwidth=''# f) u' ?6 ]& j6 ?4 X' _, }+ D" ~
var cross_marquee, ns_marquee9 u0 a- ?) X, u) ~6 g2 A9 @

# a$ Q$ r0 Y4 W9 ]3 _) c5 tfunction populate(){
5 {5 ]  }& e( }1 k. M% h3 Yif (iedom){0 p) ]/ O1 E: U2 M7 k, Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# |% ]+ u. v; m; p1 m
cross_marquee.style.left=marqueewidth+8
% }* p* {9 l' Z8 across_marquee.innerHTML=marqueecontent
7 ^# N; R- O; I" kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 \1 D+ ~4 J) p* R2 T( `+ f1 P5 C}0 d: [' A& z  i" V4 a
else if (document.layers){
; J' b' }7 e  n4 D& n3 Fns_marquee=document.ns_marquee.document.ns_marquee2% n0 N- x" F% J0 {$ A
ns_marquee.left=marqueewidth+8+ R8 E" ]! r: ]" [& O
ns_marquee.document.write(marqueecontent)
% Z; r  P' ~: \ns_marquee.document.close()# Q" x5 e3 `9 B1 h( v- ], U
actualwidth=ns_marquee.document.width, R3 s+ x4 B- _- w) V  I+ E
}" b7 q" {4 C* t
lefttime=setInterval("scrollmarquee()",20)8 {# f5 V0 O1 [9 o4 S: k  S  z
}+ ^( I0 i, \+ @" n1 `5 C7 j
window.onload=populate
- c' u# A8 c' D* c" F* H1 E9 S
  l. t$ ~6 @' Nfunction scrollmarquee(){- O5 ?2 R7 u! I8 X2 m4 X
if (iedom){& A4 h! W% {: O( k& W8 ?: U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( g( J" _* V' k( j% [
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 s) T4 K; Z4 F4 Z7 W+ J; `else
2 _7 {5 J2 a! H- v9 \cross_marquee.style.left=marqueewidth+8, W! J) q& i$ ~; z, R
2 B+ r1 W- I  y& L
}# b4 t5 t& T. S
else if (document.layers){3 R+ U# T  T; M
if (ns_marquee.left>(actualwidth*(-1)+8))
% [4 s" A$ o8 s7 }ns_marquee.left-=copyspeed7 L2 U" _! \) `0 K  F5 y. }
else  L2 U3 U% ^. K' f' w* s7 U
ns_marquee.left=marqueewidth+8! N& x- Q! ^  j! ^5 _, e  O
}
6 f* b0 [, _1 e! W}; T& h$ h5 d6 t6 D5 Y7 e- P4 \3 D
3 h; O* l8 P$ K1 ^0 L
if (iedom||document.layers){
- d  q+ a6 f6 v0 }: g; L5 ]) uwith (document){
7 p" f1 {/ Z$ X! p. hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# p! j2 z( R& K$ m* q. Mif (iedom){
3 R5 u& k1 s. s9 r- P; Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* e4 o; ]6 l) ~9 [5 t7 R+ g' W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 W7 ~* b: M1 }0 n# T) U; ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 c9 ~& T- @1 v" ?
write('</div>'), `3 T1 s/ @; s: a$ I) h
}
% r& h! ?+ e' nelse if (document.layers){' U. h  M' A2 D2 W+ x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% k: {7 B4 t  iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% H, [8 n3 z: O/ |, R5 Dwrite('</ilayer>')
$ n: F8 [: H6 ]+ U* {5 B8 }: t}
" J# s. E: b* Y- z2 Bdocument.write('</td></table>')0 A5 }0 \( o1 Y* |; o8 g
}
, p  B4 Y# C+ l' K. B# F}) p- v) I3 B+ {  t
</script>

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