返回列表 发帖

网页之跑马灯文字特效

//修改宽度# D1 F6 m: G  U2 p' D
var marqueewidth=300
8 [# P" c; _" M. A5 U//高度0 c1 l8 ], {4 `2 C- z: K" r5 C
var marqueeheight=25
4 C+ L% E4 k8 R3 }: G//速度(1-10): J  p- l5 M& z4 B# s  }  [$ I' L
var marqueespeed=3
* c5 g! |+ R- n8 @; \//背景颜色
* n3 y' ~1 E" s+ Y. z9 A6 b( L  B6 hvar marqueebgcolor="#FFFFFF"
- j7 f4 e7 g4 S4 h  N8 z//是否能暂停 (0=no. 1=yes)?
: j% X3 x) g/ @! `5 c; s) lvar pauseit=1
$ n3 d0 S8 l* p- b
- ^; d+ ~, x' @/ t7 W4 Z0 |( j. K//修改显示内容
% L3 x: C/ S, G( i9 Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* o5 l1 F7 y; @- ]# r5 q4 K4 e
1 o0 r( D9 O; o! ^& V$ U$ f( o' Q* t) s- d  n4 z7 x+ C
////下面不需改变////////////3 t2 Z) v+ R! \0 s

: y/ q9 x/ d( J, Pvar copyspeed=marqueespeed
8 i- n/ W- O- k2 ]6 \  j% z; ^var pausespeed=(pauseit==0)? copyspeed: 0
# g/ ]) @  I4 M6 P" t! G+ [var iedom=document.all||document.getElementById
+ A- ]7 E, B+ y* {" c& Cif (iedom): e% }) D, Z" S1 u; a: o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 ^# b* E* z) ~var actualwidth=''; U+ @0 s& b; b
var cross_marquee, ns_marquee# p4 Q6 u- K' b( }7 H" n+ c

% \+ F, S+ \( q/ xfunction populate(){
6 T) c0 Z; S; a" P$ s: V( {if (iedom){- |/ g' u4 X; E1 w' X. `$ ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: O+ m+ ~; y  [' gcross_marquee.style.left=marqueewidth+8& t" h2 X- x% d6 W6 ]/ s
cross_marquee.innerHTML=marqueecontent( |; w8 T6 \( T/ r+ i  e4 e& Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, |. ?* l! `& \3 j" K}( B! g# b% S+ |- m8 N9 l
else if (document.layers){$ n6 Z  C% c; v- y& K$ ~; R8 l
ns_marquee=document.ns_marquee.document.ns_marquee2
& ^5 M6 F4 f3 y. lns_marquee.left=marqueewidth+8
/ H  \/ g: E  y3 w3 P) Lns_marquee.document.write(marqueecontent)0 i9 r& g  a- a4 C7 I: H! z) [4 }
ns_marquee.document.close()  t' \1 l" w4 W2 i4 n
actualwidth=ns_marquee.document.width
" W, s9 L- [/ O2 w. r& X}
* x0 z1 ~, l5 n* }- u4 g* ~2 r. plefttime=setInterval("scrollmarquee()",20). }7 X: U- r* Y* U) d% O$ I
}
2 l7 a# Z* {& t" x$ R  L; e5 Zwindow.onload=populate
( B( a$ j; ^6 N# S. _& L# L3 r+ K  A7 ~7 U
function scrollmarquee(){8 _. f+ k; I8 |$ B* ?
if (iedom){3 f+ P- z3 G( ]2 w+ |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 [  B4 |9 c/ d+ D! O! hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! U3 Y9 k4 }# a: }3 gelse
9 V# S1 \& j0 \+ q, Across_marquee.style.left=marqueewidth+8; i. o  Z" v7 s0 `8 k8 F
, u3 J4 Q& f+ d. V: \; b
}' ]+ l5 H! u* n3 b' I
else if (document.layers){. e" H1 O) `: _& [
if (ns_marquee.left>(actualwidth*(-1)+8)): ~! V% d( @4 e4 k& @
ns_marquee.left-=copyspeed$ [7 M+ {% P& F: P; b
else+ l5 y% l, E; a3 n
ns_marquee.left=marqueewidth+81 Y4 z; c+ `7 Q0 w4 U# w+ X
}
' d) Q  d0 s' Z; c& M}
& E$ R, g% {7 _3 O; u" X
9 b) I3 z& W. {- ?5 j4 Qif (iedom||document.layers){# e: H3 T3 c$ m, @9 y& }! A5 s
with (document){5 P8 z, |# l4 ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: A( u1 }. ?& S) O- ?if (iedom){$ \, n1 ]& C6 p5 U+ c3 d3 I5 s6 v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) x8 k. f4 ?2 K' b4 g7 |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 t" T1 e) `) n* f8 T4 f# l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 Z+ R& ]. A/ vwrite('</div>')
' \; Z: I: o7 V, N' c( }}5 H& [. V7 E/ Y8 P( g. Q- P
else if (document.layers){2 S* L  L& F7 G2 z. B7 X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% P% C7 }# ?: l$ Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  Y* Q+ i8 d/ P" k; nwrite('</ilayer>')
6 Y) j; L, e2 s  W2 A2 S# r4 Q( P- d% ~}
* X- ]% ^1 ]9 z$ |8 P, vdocument.write('</td></table>')- j# `* d# ~' S* H5 w
}6 W, X& c. v% C: @0 k0 Y5 f3 M
}* ]/ Q% O+ L( a6 E
</script>

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