Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度: x3 k" K% }$ I
var marqueewidth=300+ n6 n) F' ~; s- b! x
//高度0 l" E4 z! r$ c0 l/ d* q" n1 I
var marqueeheight=25
) S9 q. F* K- j2 x3 o//速度(1-10)
6 T2 _, Y/ X& P. c; |var marqueespeed=3
* ?4 V0 x" u, g, ~) N9 \( O+ `//背景颜色
5 D- G( P( U: ]0 t0 t9 {var marqueebgcolor="#FFFFFF"5 S- A  i+ o4 T
//是否能暂停 (0=no. 1=yes)?9 y. C. j& h  V
var pauseit=12 u) |- v: P, R8 ^" a/ v$ C. B# q

: s; F$ Q5 C1 q2 n6 [//修改显示内容" Z% u5 B% U  y* ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& U& \! j+ \' J6 A9 y

: b2 t7 A% F5 ~) G  c
9 S* e% p1 X7 T! e; y& R1 q5 I' _////下面不需改变////////////1 Y  I; i, M! V3 p- ]6 Q

) M0 K7 w6 I- x# O/ O. S$ |/ Uvar copyspeed=marqueespeed
4 L4 @+ u. m) ~) ^7 _, \+ i! Lvar pausespeed=(pauseit==0)? copyspeed: 0
' ?5 ~. a( c1 {& bvar iedom=document.all||document.getElementById
1 J: H& ]5 R2 g' `if (iedom)
% h5 l- Z& T8 T; g# s. ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' v9 A- a5 m  s9 g) I/ n( a1 t4 vvar actualwidth=''
9 a- z( L; q) j; nvar cross_marquee, ns_marquee
# j/ N, ~7 E6 J% k; ~# ]1 @0 b6 K5 m2 e, l3 h9 M
function populate(){0 J3 D; @& S; |! P; [2 Y
if (iedom){
& J/ g1 v3 g! q' J1 K/ b4 @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 f, M3 V2 j8 H/ O& h" F2 p1 m
cross_marquee.style.left=marqueewidth+8- j  |3 l+ a3 f1 Z% O
cross_marquee.innerHTML=marqueecontent# n( r8 N  t/ G
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) B. g1 D$ l; Z& ^# Z* B
}
6 `, L) |& N3 u" Oelse if (document.layers){
- {- y$ d+ U0 F4 I8 Pns_marquee=document.ns_marquee.document.ns_marquee2, ~9 K0 p2 J7 t  ~( R
ns_marquee.left=marqueewidth+8
. p# b9 v3 j  O+ H: C. p8 L- Ans_marquee.document.write(marqueecontent)6 Y0 l( R9 k* V, o8 h0 d5 a' e  j
ns_marquee.document.close()
* J1 ~0 K) r# Cactualwidth=ns_marquee.document.width
( y, Q" F+ Y! r}
3 @5 p4 I3 ?8 S# k2 |. r+ Xlefttime=setInterval("scrollmarquee()",20)
. M9 m; P* q2 {3 L2 d}
( v, ~7 y7 f+ z6 M' f: c2 |; iwindow.onload=populate
. j8 \& @2 o# a" r( ]0 A7 I3 b7 ?9 M5 h: }+ J5 I
function scrollmarquee(){% ]7 i: g. a" f
if (iedom){: Z; l0 g, L' J" K  a7 W+ C- c! j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( M1 ~1 E* N/ g9 |& B$ a  K' Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  l+ r' j1 u, e3 a# k5 o$ Oelse
: U$ e8 z' `2 c( p: D4 ]- z9 rcross_marquee.style.left=marqueewidth+81 g0 j! y- C; ~) ?
2 s; s6 p3 Z5 l5 `
}/ s. W1 v  W. M
else if (document.layers){1 S) @& h1 q5 r7 A/ S4 z: u/ f# ?4 g
if (ns_marquee.left>(actualwidth*(-1)+8))
4 A7 l+ U+ z0 g; ~ns_marquee.left-=copyspeed6 G( b# C/ y# l' A$ `5 b
else5 j& {1 |7 a  I* g
ns_marquee.left=marqueewidth+8; x" |; E# M/ ^5 B6 e
}
$ L& Z% u" t, H& ]: _}
* l- }/ b! c  f* J$ U+ z
' D. M) c, y) P) v  ^2 c; N! Vif (iedom||document.layers){: ?# H  i  p" m* \- e
with (document){
) x4 V  ]0 U$ S7 l9 p4 `document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( D# @' p/ g8 ~8 t9 k
if (iedom){  a! N9 ~, W% N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" _) X# Y9 e8 X. \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' ~, ^+ y. i4 l" A" W* `1 g3 Q" [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' v: S) R+ W" d2 z, G2 z1 S  e+ Q
write('</div>'): ~- u' V' @1 }& ]) |
}
4 z% J7 }9 }0 q' k. Kelse if (document.layers){
  i; S, i6 Z6 B4 _7 ]. zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- P. y6 ?7 P$ M; V  x1 \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* }4 T' h: Q+ q/ |write('</ilayer>')
7 {+ K& n- C. ?. C& C3 O  _}
& j8 z' _6 o# ?* E6 Idocument.write('</td></table>'): @# Z- B# a. f, o  d$ f! N9 i
}
' s7 ^5 y  P3 _/ F/ V8 q% i  Q$ f}
4 l& ~2 w% c- Y; Y</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2