返回列表 发帖

网页之跑马灯文字特效

//修改宽度. q5 O# k* u. ^6 [) j8 C
var marqueewidth=300
1 `; \1 y  X* l//高度
4 H$ Z! I7 k1 q: Dvar marqueeheight=25
, g* m6 x; T, P* y6 h4 T  o" R5 A//速度(1-10)" D" j7 `- g1 Z/ l0 K
var marqueespeed=3
4 ~- K9 V) c0 f7 t+ D. u% f) W" }//背景颜色
9 G! a; A$ [5 z8 z* ovar marqueebgcolor="#FFFFFF"
2 Z0 f: f$ _* Y. Z7 Y//是否能暂停 (0=no. 1=yes)?
! I- R* s: x3 S7 q% c2 rvar pauseit=1) \& @; g8 J3 v1 M' H
% P, t# Y, i2 ^% t0 P) K
//修改显示内容1 g. ~* \+ f; E+ @4 l# a8 ]0 E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  Z3 K% s! l* L/ U5 y* V
; n% C+ M& [/ B; c5 b
/ \. e6 A' ]: s4 x7 e$ d////下面不需改变////////////
( F# f& H5 ^# k  w! {/ r. A2 Z$ Y# x, G8 g! L7 W% D. C
var copyspeed=marqueespeed; h# i$ \  m5 I  a2 m
var pausespeed=(pauseit==0)? copyspeed: 0% c& I0 h( Q6 B
var iedom=document.all||document.getElementById) S$ y4 L4 N$ H( K& v; p6 a
if (iedom)
# f1 J) H# X5 e$ [" ?" odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 c1 o3 j, @% L2 f
var actualwidth=''
$ l+ y$ m# {. b7 W6 w$ C8 Rvar cross_marquee, ns_marquee
! d6 m/ x- a. H/ s; X  M0 {* u; l3 ^  O6 G8 s2 P. S" p) X
function populate(){0 g" F6 ^+ t" u8 w
if (iedom){
; ]. N! r* o2 N0 lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) a2 g' w6 C" [+ `cross_marquee.style.left=marqueewidth+8  z2 ]# `+ J- _# t
cross_marquee.innerHTML=marqueecontent
% a, ?% B! h( M$ f; [  W6 Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  z& t+ a/ ]$ G; v, q
}
" b! [  n8 C/ y0 a* K: V; l7 kelse if (document.layers){
" B5 j* c( T3 Bns_marquee=document.ns_marquee.document.ns_marquee28 v  j. f1 F3 t* \6 S' [3 R( o4 d
ns_marquee.left=marqueewidth+84 e+ f0 k" f$ {: g0 k5 M
ns_marquee.document.write(marqueecontent)+ Q/ I3 c0 C" F/ ^; V
ns_marquee.document.close()
( @8 ]: s3 ?' Q% ^; ~4 W0 ?actualwidth=ns_marquee.document.width, F3 L. g, D  f5 ?$ n0 b* X
}
4 G  p$ G+ d& ^% T- {' Tlefttime=setInterval("scrollmarquee()",20)1 k4 N2 V" {4 T' G& C5 {
}
) }! h! C1 P9 _4 nwindow.onload=populate
4 g' O/ [1 l! J2 _1 x4 J: i( g5 z: }) N$ f5 f; |6 L7 q0 B
function scrollmarquee(){6 B' ?+ ]* B# E+ @& J. \
if (iedom){
5 I3 R0 M7 F. |' b& O# C0 Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ v8 m0 _- L# f' }. `/ h+ Qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 ~# N4 u* F- O; i  ]( R( Ielse
* C% e$ o- n- E2 n, Z0 G3 ocross_marquee.style.left=marqueewidth+8# e5 C; d- l3 m. M, [2 ^
6 m3 ~7 }8 G& U% a0 V0 u4 p. v1 ?
}0 X" N9 Y7 P2 R, b! V- N3 V# u! E
else if (document.layers){  U; u' o5 y9 X* c) K5 h& n' j
if (ns_marquee.left>(actualwidth*(-1)+8))
9 n# t8 C, x6 M& ]$ b" k( ~ns_marquee.left-=copyspeed
! s% m2 k! [) z* `! ?else
8 D3 |6 q5 Q+ |* B. s) Jns_marquee.left=marqueewidth+8
# n# v! F1 _" n+ n9 k}1 |$ h  n( f4 b! X  x( R5 E
}  q6 E9 C. }$ l+ R# {3 n) P" L
. N' t4 u1 Y2 C
if (iedom||document.layers){
, k$ W0 g' [( ^2 R; M' Iwith (document){; R* Z3 b! X" l- B6 w6 i+ G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 r* m. W' ?# h) n7 r
if (iedom){: z) h% U, k' c* _, N* G% }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" J. C; o/ ^, X; b9 W1 Z! a: c. B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 C  I- F" ~9 l7 A8 M1 C* P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 M/ j  N+ I4 p4 E& d8 u
write('</div>')
& [) H) l. g" k6 f* J0 z}
$ p( [. v2 e+ r+ L+ U6 \% F6 selse if (document.layers){) T' C6 Z4 G# ]4 R* A, f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- e& k4 i. q5 q# s! u. \6 U  ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 K0 T) `. y9 \* v  z4 A
write('</ilayer>')
) C" G7 u- A  ?% t  i' m8 k}
) n- {" T* |# C. C3 P: [document.write('</td></table>')/ p$ ]% O* }( v" j) O6 O
}
# b; H1 F1 a, t: A}
& }1 q9 R5 Y# h- e</script>

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