获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 b: B6 }7 n- c0 S3 N' Cvar marqueewidth=300! M/ v/ S3 |3 S; I% e( R
//高度4 ~' x" f$ \. `5 B0 _1 ?, V
var marqueeheight=25; d2 x' V+ n( q* l" D1 I9 ?
//速度(1-10)
# I0 t/ l9 D1 }) T4 y  ~  Avar marqueespeed=36 w: ]$ e( z* R' P
//背景颜色
( d$ C1 X  j, z2 tvar marqueebgcolor="#FFFFFF"& u6 |, A) [. D  p. v. U
//是否能暂停 (0=no. 1=yes)?
: M# E$ u0 z8 hvar pauseit=1" l. \) f' R2 y, H
! F% j# Y) K3 x$ [5 I' [) c
//修改显示内容
& g5 O2 V1 H  H+ a8 l! z* pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 ~( [  }! ]" ~( x2 ~- b$ [$ E
4 p4 o, l7 _8 W- I* C! z3 X
% o: F# ~  n& @: S+ I
////下面不需改变////////////
' j& e2 a  q) H
; [, y7 s: T+ z" \2 g( J$ f4 r. Yvar copyspeed=marqueespeed
7 Q4 e3 u- h" cvar pausespeed=(pauseit==0)? copyspeed: 0! l0 n  f* y# ~
var iedom=document.all||document.getElementById
+ D8 Y( b3 x1 I$ m3 B, @6 |0 N8 xif (iedom)& [: P: S8 W' x0 {+ U5 h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 N. M; h2 h4 ~- J! {0 c$ v9 A, _
var actualwidth=''2 ]2 X$ Y+ q# X" o# _$ n4 k& A  q
var cross_marquee, ns_marquee
. J) c/ a: x7 e& a5 }
) w; m' u8 H( Vfunction populate(){4 G+ H" I% P9 I0 n  [! ^
if (iedom){! k# ?6 c# u( {, U" I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. V9 F1 o; b+ \- v. v$ u! Z4 e5 d0 x# [cross_marquee.style.left=marqueewidth+8
2 W% G! G; j# D( j. I  rcross_marquee.innerHTML=marqueecontent' }8 w7 v2 q2 \7 I) @8 f
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 g& F& b" @& \; ~# d/ E& `# h2 x
}
# [, t1 _; N: T( J6 X0 p# F& c! y2 ]else if (document.layers){8 A: F$ J' n! G2 q1 u. u
ns_marquee=document.ns_marquee.document.ns_marquee2/ o9 ?3 R- E( N3 B% B! w, s" ^6 @
ns_marquee.left=marqueewidth+8' }1 Y# ~0 x) ~6 R' `% ^* z1 E9 W6 w
ns_marquee.document.write(marqueecontent)# ^* p& B$ @7 X4 s
ns_marquee.document.close()1 t1 I4 X. p$ S& u6 y( F- K: B  m
actualwidth=ns_marquee.document.width
* u1 g5 j* o# G/ u0 K% u}; Z) R& I6 }6 c1 w+ ]$ B. f) |
lefttime=setInterval("scrollmarquee()",20)- p+ Y- b( }/ Z+ I
}
. \( j+ S9 o6 `- jwindow.onload=populate. v; ]  f: g  ]! t2 R. L
' V" l1 {; v1 t7 T
function scrollmarquee(){
3 f+ N1 E2 @0 b4 T2 Rif (iedom){
/ |) l6 V$ ?' u: Z% o( Y7 [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# ^3 c4 ~' M  @9 q/ @7 Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 R+ N$ C  y# @+ ?. o) Pelse8 e2 U+ E% I: d8 T; U3 `
cross_marquee.style.left=marqueewidth+8
. i  w0 N) W' g& J7 Y9 {
5 c/ x' c% a- r}; T4 ~" y! w* D0 o/ D9 F2 J, _
else if (document.layers){& }1 E* ?4 M' g/ B
if (ns_marquee.left>(actualwidth*(-1)+8))' k6 a' |+ {3 h  ]* ?' b. @. C: y
ns_marquee.left-=copyspeed
1 w4 N3 |& j( p' telse; Z9 G$ C" z3 j4 ^4 e: y5 n8 ]* q! h  P
ns_marquee.left=marqueewidth+8; G, j2 [2 Y8 M4 u# ~* g! J
}
  C& W" b  V. y- i) A, i}
# \& r, I6 r7 @" n6 k
$ u# D, V6 O& T* R3 G1 i* Hif (iedom||document.layers){
7 A( N0 a9 T& d6 k% x$ k# G2 h& d0 swith (document){
! g, a9 \7 V# E. _; E- Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! z% V* d! K- I8 N* ]1 i
if (iedom){% s+ O2 P9 Z) G# F+ o; H# S% J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) g7 V; V) l) l! F3 e9 x1 Y/ kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 V3 q: w6 u+ _3 Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). h& J) _5 y1 p# x" n
write('</div>')9 \# Z7 \# U- P2 }7 \
}- g) X7 T$ Y. g, I3 G0 Z7 G
else if (document.layers){1 O9 q, V9 |0 t, J. Y( [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, X" ?& H8 W5 h( Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: E9 Q6 u$ P/ m& k; Qwrite('</ilayer>')7 A  n8 H) {; b4 a0 ~. k9 z7 Z
}
! x  \9 N- M# c6 y2 R: N/ c6 Cdocument.write('</td></table>')' [' l1 A, L( g$ f- ~, }3 s
}
3 L# n  A2 k( A9 k  L}4 \3 O4 I; u5 x! I
</script>

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