返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. {( h7 W5 I' dvar marqueewidth=3004 V4 y3 h. N( I
//高度3 C+ T/ A5 o% v  b9 P
var marqueeheight=258 m) q  E9 T7 m/ G
//速度(1-10)
* Y/ m9 a- ?5 Y' A, l4 \. s& jvar marqueespeed=3
: J9 f: B( X9 Q- y//背景颜色
8 B, ~5 }, L5 ~6 M, l9 e3 hvar marqueebgcolor="#FFFFFF"
: G9 \( L# ^3 T( q0 S. I$ m1 m//是否能暂停 (0=no. 1=yes)?# D3 t6 J+ Q" c% {% O
var pauseit=12 Y' `7 N2 g9 ]" Q& d

  c, }& o* Y* _' j6 |//修改显示内容& b3 b4 p9 D% [* r) T
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 Q& Z7 q( f$ Q, U; P6 j+ I5 O, t7 h  s6 w4 ]& l

8 R) _* `6 |/ l1 h5 V////下面不需改变////////////
! ]1 ~4 q& X% v1 I% K' z$ u' Z! b9 G9 ^0 n9 q( c1 p. \
var copyspeed=marqueespeed3 n9 n" p: I  q6 F
var pausespeed=(pauseit==0)? copyspeed: 0% p% }8 c5 c/ ]& U( c7 w
var iedom=document.all||document.getElementById
( A5 d: T3 R- a% l/ O% N. _5 yif (iedom)
3 S8 M6 {, B7 m7 ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 d7 c. E' ^/ \  S2 y" K  R
var actualwidth=''
7 H6 `/ U) `' f  X# \% _var cross_marquee, ns_marquee
+ z, a% z& p- ?7 a7 g/ v% i. i& {! h  y* ]9 d; l5 d$ C& @
function populate(){
1 |2 F. Z( H. v5 H2 F$ ]4 iif (iedom){4 p9 y4 ^: j. s4 `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. U5 R/ A3 H6 F! L0 }( f
cross_marquee.style.left=marqueewidth+8
' `9 K9 H) ?: A+ S8 dcross_marquee.innerHTML=marqueecontent4 t0 k4 R# B, o, z% ]" w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) _% H6 t! N7 I5 |3 H}
* _6 Q5 n' a9 k) l: D6 N1 W! D5 felse if (document.layers){& Q. M! z# `! ?& g
ns_marquee=document.ns_marquee.document.ns_marquee2
% ]( O1 k) S6 o# Q$ D7 j8 Wns_marquee.left=marqueewidth+8
. ?4 x, n9 q; k+ }ns_marquee.document.write(marqueecontent)3 w$ w" S2 s+ U! [# B5 A4 s' Z
ns_marquee.document.close()
9 E0 m" u. S; {actualwidth=ns_marquee.document.width
4 g5 R) W, w2 E& X; A}
3 R; C+ B; ^0 |& e9 Klefttime=setInterval("scrollmarquee()",20)
6 R2 z$ h. b& z* O# V) e- ^1 S}% i+ j$ X0 f5 O/ c5 c4 J
window.onload=populate& V7 W& k9 e# X2 J
. S: ?1 e: H6 ^3 K4 \
function scrollmarquee(){
' A% e3 n8 ~3 V% nif (iedom){
4 [( B* k8 ?; c; Y8 Q* pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ R5 j( t+ `% T3 ^! f' F
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  U: h% H% V$ j; Z5 Y! O
else
- {: B, l/ W6 n. i$ J4 @' A$ O+ wcross_marquee.style.left=marqueewidth+8
* {0 [1 M$ O! L) r0 @+ W; z" E* h) h- _% v; `& l
}# [% x$ \) p! K4 |' ?) a6 ~' O
else if (document.layers){! V; M  y" W3 C+ D. d; }" k) S
if (ns_marquee.left>(actualwidth*(-1)+8))
8 P/ t7 L! q. C$ V  tns_marquee.left-=copyspeed
* R* H7 e( i$ B* d4 v# A/ `0 Oelse* d* D2 i  y- P" V( n8 p
ns_marquee.left=marqueewidth+8
- P0 Y! D% z( Z' \9 d2 J}" v' m. x/ W0 _, J  o$ z, o6 c
}4 p+ S& j  M& g! p( v0 D2 R

6 r, h5 J" }+ Bif (iedom||document.layers){$ ?5 t4 L9 L! a( O/ N
with (document){" ?( n% F( q3 ^4 z0 X# g
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( b8 t/ d8 P/ j1 o. X% w' I
if (iedom){% t- B' j; V1 r8 l
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% Q6 R4 t$ U, y5 Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). U( p' e  n1 [; [* j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 ?$ K6 a5 j2 E
write('</div>')
" V& y* A- A, \+ b+ \}7 M7 K" ^; j- ]- F" S
else if (document.layers){
7 s/ M9 p3 W* Q2 g. u/ X  I$ uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ C1 D) L! p4 `, g* f( E+ swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 x1 H3 U! p! t/ A& E% x# n. Gwrite('</ilayer>')9 q+ Q: m. M) M4 U! N, k* @" ~" f6 x
}8 O8 l" k& n% y: o5 `) W+ T2 u* e2 |
document.write('</td></table>'), x  X# w, U; P% l( G: t! r* n
}
- {# n/ O0 I8 l6 |4 d' t) f5 z( ^}
  i0 E" [# c* A8 Q1 |8 r. e</script>

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