返回列表 发帖

网页之跑马灯文字特效

//修改宽度' C6 }& S( [# Q- V3 l6 ^3 ^4 t
var marqueewidth=300$ g1 x# p+ N$ K$ f
//高度
, Y- p, o$ d3 N: {$ [var marqueeheight=259 I+ s% s, v) E6 ]- D
//速度(1-10)$ c. {1 ?  q: B1 W1 \9 i6 [* E* L4 O
var marqueespeed=3
0 \/ S8 x: M% f' O//背景颜色$ ~5 }% t- E. s7 H: }% c8 C+ j
var marqueebgcolor="#FFFFFF"4 u! F. y' P  X2 I! y% ^
//是否能暂停 (0=no. 1=yes)?, q9 F" e! i) I( ]3 N$ ?* g
var pauseit=1
/ C9 ^' E4 Q/ f
6 [, Z/ M0 w7 |" m$ ^//修改显示内容- p' b4 G- _8 _0 W; E* ~; |
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 |/ q2 _, H1 ~! R# ~1 o' c9 t* z
4 T) t) V4 K0 E6 x* x

, o/ x3 k+ ^; R4 K' f////下面不需改变////////////- y& v& q/ R' I. e2 ^; G# @

: H' |7 t' h/ _" u9 Kvar copyspeed=marqueespeed: J5 _8 |: i; H/ ?: o/ f" d+ H
var pausespeed=(pauseit==0)? copyspeed: 0
" b/ V+ r" l# ]! t' ]. Y  w/ f; ~var iedom=document.all||document.getElementById
2 m) l4 T# r* {5 Wif (iedom)% N  V) m- V( W; L; t, {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) E* c( S$ J0 d3 Q' h
var actualwidth=''
2 @3 d) i8 s' N: dvar cross_marquee, ns_marquee+ `; p2 j# r8 U( X' z0 t; F9 X

9 S& n- T0 Y* J1 R  z6 X) Mfunction populate(){0 F. P1 S: O/ W* f; e
if (iedom){3 T$ B4 I$ p% n, N* S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 x0 W5 L9 ~/ \& I$ E# Q& [; z
cross_marquee.style.left=marqueewidth+80 @% K2 J0 r8 o, f6 h' }) L7 O
cross_marquee.innerHTML=marqueecontent
9 s4 y3 D& c4 A7 P( Y3 t+ j( Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 f- |6 T' B. U1 K4 ]
}! Z6 @! y, I; e* [. u3 W# j8 k
else if (document.layers){
( F; [2 |' ~* U/ \ns_marquee=document.ns_marquee.document.ns_marquee2
, h5 X! x3 Z7 {ns_marquee.left=marqueewidth+8/ t. k( L: U. [; m0 U( }) B6 ~) Q
ns_marquee.document.write(marqueecontent)* a1 N' @  t* ?& E: K+ S7 `: e
ns_marquee.document.close()2 G- I' M$ T0 I1 \" ~/ y
actualwidth=ns_marquee.document.width4 ?' h% R9 M% [) j( Z7 E4 @
}: R9 F2 u$ o7 q$ s' a+ L7 x
lefttime=setInterval("scrollmarquee()",20)- Z+ X- q# C3 {7 s/ H( W- m* t0 f" \9 A
}
" B+ ?$ _) @4 O3 t! vwindow.onload=populate: `+ T/ ?5 ~/ R  ?; b
  }. V. k8 a1 b$ }* A; r
function scrollmarquee(){" K) k6 M; `" J, T! {6 Q
if (iedom){
" l$ m0 O  x3 Q# j; aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 Z3 g2 Y8 S. b; S5 K% _$ Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) d1 Y0 o& @$ {) x: o
else. W1 [% U# n0 x* n$ i
cross_marquee.style.left=marqueewidth+81 E! B( F! T* M! Q1 P( N/ L
( ~: X- \* k. W2 B
}
1 ~( P) m( A; Belse if (document.layers){" H5 Q& y7 G  E$ G% e8 o3 H
if (ns_marquee.left>(actualwidth*(-1)+8))/ F- X: ^9 `, z! G6 J
ns_marquee.left-=copyspeed
0 G* p1 Y9 ~' ?else9 C2 B$ s" J2 I& s
ns_marquee.left=marqueewidth+84 O$ ~$ V8 e. f; e1 c& V; n* J) V+ `
}
. F+ y& ^% G. z, _& s' f; K}1 \: ~" ^0 Q) A( r. z" n
  U, `5 s+ l: e+ {
if (iedom||document.layers){4 x2 z) {% Y2 D5 B4 j" Q) z, m0 D
with (document){
1 X+ j* x) m2 J; {* V* J8 u* tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) }: R- j* T9 P0 M% g4 l  @! |: [if (iedom){
  e$ Y7 m! q  Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 Y+ v) q- M: o* [2 Y+ uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) e8 w5 \+ W' M& i0 g( `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ h7 g9 Q" u/ f0 Y  h' z
write('</div>')
% @7 R8 c$ f$ {6 ~1 \1 I3 _}
! Q6 k7 T  L; T: k% relse if (document.layers){! ^9 L: W% |3 N. A0 C. R0 |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 p6 v' L/ r! A- X. X& a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  y, `7 Q$ h5 C* |write('</ilayer>')" q" Y* L% H2 J( v5 U3 U: x
}! J* N" L4 M0 Q2 p
document.write('</td></table>')
1 P/ V; x( g$ Z( e) j# p}
" S9 E, a" ]4 O- W/ a$ F}
* ~4 K4 L2 H1 K& L0 R</script>

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