返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 C8 Q, K3 M) j& Lvar marqueewidth=300
  B4 k6 I$ f& E6 K: P//高度
7 S3 ^# Q( Z% @1 B- yvar marqueeheight=258 q% t( c, O2 u- J
//速度(1-10)
. c9 Y1 l8 E3 V* h% m1 evar marqueespeed=3
1 T8 q0 m" l# e* a6 m//背景颜色9 ?6 i* Z' S* u( R. ^
var marqueebgcolor="#FFFFFF"
( e: m% L2 G' E& B* G$ [3 ]+ z) }3 q//是否能暂停 (0=no. 1=yes)?
6 }" M8 T$ b+ Y% `; rvar pauseit=1: C" k4 V+ K& e, O% W7 Y* x

8 u4 p2 s7 d: D) i- _2 I//修改显示内容9 K1 P. K  I8 Q" N* S
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# _" m5 j) y3 C- A; u' Q& I  z5 w/ H
, z- N" t) G9 H; O3 {8 B
////下面不需改变////////////
% }: M7 W, d" W$ k# C( ~% v  q9 i6 b, n
var copyspeed=marqueespeed
* k: l% }6 q! p' B) x6 f* P& cvar pausespeed=(pauseit==0)? copyspeed: 09 x) o! n6 i' {! s8 f* l# K8 c
var iedom=document.all||document.getElementById! `8 B0 r1 q# w) S
if (iedom)$ I. h8 g! _8 `' I4 b, f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* H# j0 y1 L/ d8 M- zvar actualwidth=''8 J; y" |/ I. o6 J7 h
var cross_marquee, ns_marquee5 a; c  P  R3 Q8 T+ i  d6 z' t. ]
3 q$ {+ e7 K  Z1 Z& F/ K& b% K$ c
function populate(){+ ~7 O' z7 f% l- R* s
if (iedom){- ^! j7 P$ `( ?# n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" f' i  i. h% T
cross_marquee.style.left=marqueewidth+8
" u* c  O* j, b" ycross_marquee.innerHTML=marqueecontent
) u& G( F* c8 q( Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' j7 C/ Y) k0 v+ ?4 y0 E% Q
}
6 u- _$ B4 V, i& zelse if (document.layers){0 u+ A% r6 M! k" }8 r
ns_marquee=document.ns_marquee.document.ns_marquee2
9 N) w2 d/ n1 }ns_marquee.left=marqueewidth+8  R6 o' `/ \7 }( j) a- Q
ns_marquee.document.write(marqueecontent)
+ e. S* {1 I) i' h0 }  _ns_marquee.document.close()2 f4 V. ?; }% H% j" @
actualwidth=ns_marquee.document.width& C$ B$ A/ _. F
}
* c& g: f* d  [4 d5 [8 u. dlefttime=setInterval("scrollmarquee()",20)# }- A' R# j( E* I
}
9 p7 c. \& j  _  K" _7 u$ J. zwindow.onload=populate
  H4 S1 a0 C# D  y9 w. Z
" ?1 P0 ^# N( w; [function scrollmarquee(){
/ h8 I" T$ s* O4 tif (iedom){
5 G% G/ p$ n% f. D$ zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; m1 Z0 e0 X0 ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ L! j* t: |8 W' V5 E& t3 selse
; [. V! X- n$ ]- a1 @6 Mcross_marquee.style.left=marqueewidth+8! h" O5 Y7 d4 A- P8 Y1 j8 V! y
5 Z. n# T' a" B/ q! O' |8 c9 `
}6 J# H8 ^, i& a
else if (document.layers){" ?6 l5 b* d* p: f3 [
if (ns_marquee.left>(actualwidth*(-1)+8))
% D7 d; Y, E$ y1 D% Vns_marquee.left-=copyspeed
! R/ w/ _) F) L5 s6 lelse
: i" D/ x( e6 Y8 J+ Z2 ^1 m* @ns_marquee.left=marqueewidth+8* E5 b; L3 H: e0 l. O0 ~; b3 B
}
/ {4 a+ Y6 R4 a" i1 u& c; u6 ^/ f}; c( T8 A9 w: G
1 h4 O9 C9 u8 I
if (iedom||document.layers){
# z  n  j) @9 nwith (document){
- c1 h# a$ u, Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; ~! R2 r2 g% v& J. I" Rif (iedom){" V+ L! G3 c( D/ F' y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, H" o% x7 E& twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- N! c% [$ s0 R2 Q' U0 Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; h: [( L4 y" @& Vwrite('</div>')) F4 K  r: I. Z' z
}
- i* c- @. o0 P7 v- m: `! Z( b) O5 Velse if (document.layers){1 a% y# i7 E- B- {5 e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 f( D" L6 U/ W8 Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- f5 |0 O3 r$ D+ E. C3 [% iwrite('</ilayer>'); g. k  `# u9 j: J
}
" f) Z6 Q0 k% @, Zdocument.write('</td></table>')
1 H) w3 M+ c9 }0 @# {$ m0 H  L5 J}
; t' H9 o1 `  {1 ^8 N: c  l}4 Q( x8 p% P: n" H
</script>

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