返回列表 发帖

网页之跑马灯文字特效

//修改宽度; L0 b! `6 |2 `% x9 `
var marqueewidth=300
. ]6 A3 v  S2 J3 _' p- |! B0 X+ J//高度
0 ?' c& Z' f+ S; ]6 S5 _var marqueeheight=25% q6 z. J, }: x8 r; C
//速度(1-10)
4 T; p; \8 k2 W2 p2 ~8 {var marqueespeed=3
' p# A9 L6 ^' m//背景颜色
  {; G0 G* l) K7 [% {var marqueebgcolor="#FFFFFF"' E9 M( K- \) e8 N1 A( K
//是否能暂停 (0=no. 1=yes)?
( ]/ `+ }; O0 H& a+ v5 avar pauseit=1" u. S5 G+ D3 ^2 r, H% `

8 x. J' j/ \% T. o8 g//修改显示内容; y1 {: t4 a! S
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. g* A* z; q% r  A$ c: J+ j/ l6 c& T* v. g. @. X5 k
1 ?: W/ }4 e( B* c( N7 s
////下面不需改变////////////
( ?* w$ y0 \6 f+ ?$ k7 T% V* L
* b  H; G) o0 |7 q5 c& b- ^$ v: Tvar copyspeed=marqueespeed/ H& Y2 l% |' ]$ L" `; M
var pausespeed=(pauseit==0)? copyspeed: 0
" ]( S, p& ~7 K0 Svar iedom=document.all||document.getElementById, C4 w6 O/ u5 D. ~) d% `7 U$ }; q
if (iedom)* Y. v  t: N6 n+ R; z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  K5 S! _1 @' W4 yvar actualwidth=''
: K/ Z7 |3 K" n# C! m" Fvar cross_marquee, ns_marquee
0 K( v  e5 |: |9 v" N5 @6 S  m/ x' F# W% \& }5 @: |! U
function populate(){* V+ H3 Z  i  K" w6 d8 E
if (iedom){
4 B6 |. g# K+ |2 Icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% X! L7 m) q% y" b1 u2 W
cross_marquee.style.left=marqueewidth+8
" r: d* R5 V: K" ^0 ~cross_marquee.innerHTML=marqueecontent- B" [, }" Q; X- e9 ]6 S) u0 n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, F& y: ?5 ^; c( L/ R$ X3 `}* P/ ]4 L2 c. R4 G- M1 R
else if (document.layers){1 b; V' Y! O7 z1 p7 }2 U
ns_marquee=document.ns_marquee.document.ns_marquee2+ M; ]' a! m; |6 {( `' R9 X
ns_marquee.left=marqueewidth+8
6 s6 \- u) I, `* G! n$ z4 c% gns_marquee.document.write(marqueecontent)
; k( @" p' {: \+ s+ D6 y/ S' Ens_marquee.document.close()7 }" Z* ^3 v, Z* P3 W8 l
actualwidth=ns_marquee.document.width& p$ I1 R1 {0 ^' Y% c2 N/ z3 d) E
}
* \9 V/ U1 B( T" _0 mlefttime=setInterval("scrollmarquee()",20)
$ \3 h8 f' C. ?" r& w}6 s- S- J9 C4 j0 c
window.onload=populate* \; Z. G! b9 {5 q: s" p) W0 d

2 y- t& B, W! r2 D# ?function scrollmarquee(){1 H% r  Z  t8 x
if (iedom){2 U9 z5 L3 r) q# V& _, y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 H5 B: K" p& C" N+ V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- ~- l2 \+ J9 A4 _' m9 xelse
; p' H9 O  o7 @. \5 s* Gcross_marquee.style.left=marqueewidth+8" h& z) V+ O: Y* v) \
1 |, w6 ~5 l0 P0 h" y$ i6 w
}2 N8 J4 G. \: a0 M7 \" p
else if (document.layers){4 ~8 J1 {* E% z
if (ns_marquee.left>(actualwidth*(-1)+8))5 Q, U0 d, P9 e! X0 t
ns_marquee.left-=copyspeed; C* ^: E1 n8 D2 p4 ?
else
7 O6 F' }& K( M/ Y8 [; |+ Ons_marquee.left=marqueewidth+8
! T; ~; d% h; u( n1 F  v9 e9 [}
% D) @3 k5 v* ?0 u" A/ `2 _+ n# H}6 I" I$ i$ M" T  u+ V

& U0 x7 c/ a* ?; Rif (iedom||document.layers){
: i% N- e% ]3 ?* |( bwith (document){( `! k$ n. w9 a6 w  i: c
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( t7 s7 _; \: H7 B! T- Z8 dif (iedom){. E. ]1 \. _! v$ P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 g( o+ P: @9 |' W' f9 v* D- @5 X5 ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% f) D7 A; Q1 I9 G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- N- b2 b1 a6 Fwrite('</div>')) w. f% c' j: o
}9 x/ g& ~' h3 i' k
else if (document.layers){4 m, ~" S9 g6 l( J# P, q$ K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). ]# n5 x8 c, P. |4 x: R, |" B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 N' \2 m3 h# G1 e- d
write('</ilayer>')/ p0 R; y/ `* p! c+ F2 W7 \' r  N
}. c/ p0 ]2 b0 M- y( R4 n
document.write('</td></table>')2 e; c7 D9 ~4 D- {3 j
}) ~: N- Q; r( S
}' q. `2 u: S4 J; _- S
</script>

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