返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" ^  l8 j" c2 P3 f$ mvar marqueewidth=3002 K* ?( C5 ]% [! k0 `4 K, Q
//高度
. z' ?. K9 b( Lvar marqueeheight=25- A3 _3 Q8 t2 r  z  {- v/ K  k
//速度(1-10)
) V9 W) d$ p; f# z- d( @6 Xvar marqueespeed=3& S6 q6 D" t& n3 p
//背景颜色
4 `6 k* o+ B1 D+ l8 r" Q. j, Kvar marqueebgcolor="#FFFFFF"5 X$ Z" V3 p: z' ]
//是否能暂停 (0=no. 1=yes)?( O0 t  T% o# }) @0 p& S% k
var pauseit=1( P$ M7 s. C7 }9 G& f( d
, i( s( ~8 P4 y: i
//修改显示内容
. o/ k. i5 l  d. K; yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; R  Q4 ?& {8 i2 B6 y
1 J- e3 j* o+ a: z5 E7 E3 q
9 G; e9 n3 E1 u4 U1 U3 _  x! y
////下面不需改变////////////
8 }' f2 Q* K& ]" R" Z
5 }  l/ I- ?, ~var copyspeed=marqueespeed$ C* f. _( @5 W" [1 p. z
var pausespeed=(pauseit==0)? copyspeed: 0
. G; c+ n% ^8 h0 K: Y, c* Rvar iedom=document.all||document.getElementById
: O/ [3 U1 f4 D, Nif (iedom)5 x  Q( t+ V1 I- [; q" M, R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' ^/ K! f4 c) f4 i  z( ?
var actualwidth=''
* s9 @9 ^$ t/ L; A, x7 z9 W- ?var cross_marquee, ns_marquee. v7 V( Y  G( L. X1 W7 c; {

+ l: S4 V: {% Ofunction populate(){
, ~2 A# `4 ^3 [1 ?- yif (iedom){
1 H9 H8 w6 D7 p" c8 xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% }! r6 C0 k# J1 b" n; l. n' K
cross_marquee.style.left=marqueewidth+85 k. q9 K( G+ X" |8 J& s
cross_marquee.innerHTML=marqueecontent& N7 U+ O- o3 }' v- `2 d6 m: \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" K/ t% N/ T3 X' w
}
4 G9 G$ V. @7 I3 O+ Helse if (document.layers){
- `( A! ]; ^1 t0 {  k) J! E/ R$ wns_marquee=document.ns_marquee.document.ns_marquee2
3 s" k: p& R# ~. n; h2 ons_marquee.left=marqueewidth+8* n' n& P" ^4 T" @( \0 E0 H6 v2 {$ M
ns_marquee.document.write(marqueecontent)
. g+ k* M: O3 v) ans_marquee.document.close()
4 v* v, ^9 X+ _( B4 U4 Wactualwidth=ns_marquee.document.width+ x( c3 a& E) _
}
2 A) f$ w8 p- e, Rlefttime=setInterval("scrollmarquee()",20)% _" g" L, G9 Y! B
}6 ~* L9 h- V( T4 ?! W: _( K
window.onload=populate
+ Y( T3 m% _* [; D) h+ G% V9 i  |; ~0 C6 ^8 m7 I8 [
function scrollmarquee(){
8 F% C- E; O+ J% ~$ Xif (iedom){
9 u/ ^$ j' S+ m- o; D( Y. t, O6 cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 Y1 J& v9 W5 K" j: {6 h8 Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! _/ o! G3 l0 |! H
else7 ^6 u  M4 ^. q( g3 x/ J# `  c
cross_marquee.style.left=marqueewidth+85 j3 S$ B; L' t
% a7 c& {5 L2 Q3 o# M" n
}' O( U" P+ N% Q. H# \4 V8 w$ g
else if (document.layers){) d1 L) x4 g* T
if (ns_marquee.left>(actualwidth*(-1)+8))) Y; H3 R9 W6 N2 v# b& [& E
ns_marquee.left-=copyspeed: `  q. t1 w! Z4 Y( Z! y
else
' A3 U* R2 p; U8 \4 K8 u# dns_marquee.left=marqueewidth+8; i7 H# p3 q1 r+ k& k
}' R6 S) g; @+ \  }" R$ I! }, i. U
}- |( X" m/ d2 x

% h- |! B+ [" p8 d  cif (iedom||document.layers){) z" |1 J# \: u' Y# g5 w) t/ {
with (document){; }  {7 t; T+ m. e$ E5 S& P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 w. W3 l4 {/ z) a3 c
if (iedom){
. `6 D* V3 K- u) v* M1 qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ J/ G2 z- z7 j5 `  ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. V. A8 S0 [* Q- jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  {% ]) b# b+ x$ T/ Swrite('</div>')
8 J1 S4 _+ ~6 e+ H% o}
1 a# z6 D% `$ jelse if (document.layers){
( S/ n1 |& R; B8 i( t* D$ ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* f& T) G' m! ]) ~! D0 _6 k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  h3 D! y" A6 `% T- C6 N, L/ a
write('</ilayer>')
/ w" k8 i6 g0 k2 o6 B4 O}
: M) j; f8 ?$ y5 H, r8 w2 fdocument.write('</td></table>')  K/ c; i8 x8 T+ [- s) S, q/ b8 C
}
3 L3 S2 A% a* @; D$ r# m: W}. U1 X" c) v" `9 L0 I
</script>

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