返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ J% ^( ~1 {. X- e* P" @var marqueewidth=300
" L4 K1 N* @8 I, r' @6 \//高度+ b- K+ f. x( h9 r
var marqueeheight=25
5 Y3 ^5 V# j  b8 a//速度(1-10)
3 M# a1 D5 |. [0 B% rvar marqueespeed=3
6 L* Q  q* [3 P" @. L2 m# z) f; P//背景颜色
) j6 {" _  r' X+ B+ I9 K: lvar marqueebgcolor="#FFFFFF"! g7 \/ [% {  `
//是否能暂停 (0=no. 1=yes)?8 P  X6 k, K5 h5 B; u
var pauseit=1
, I* Z3 [5 m; y7 ?6 S. k
- I% G) z! F1 S( j6 R( `7 F& e6 e//修改显示内容
6 Y! N; l1 J) T; Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' H# {# G$ a! E

$ }; Q$ K! Y2 z3 ]( l" g
$ k7 {& L3 E* P0 l9 ^////下面不需改变////////////
) B* Y* S$ `& h8 y# I. v) U0 R9 v+ O- k) d
var copyspeed=marqueespeed8 w3 f8 J4 {' I+ }) ^6 }
var pausespeed=(pauseit==0)? copyspeed: 0
4 h3 H, [* |7 l3 R. U9 ^% Q7 R7 Ovar iedom=document.all||document.getElementById$ ], N! o9 B' }- [
if (iedom)
- c+ Z  `8 J+ r. L+ Y6 N6 Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" ^. t  t! C. u* M- u5 |
var actualwidth=''; V1 \7 {) o. g3 B
var cross_marquee, ns_marquee& v; k$ `0 \& \+ Y% t/ W

# y! r7 ]* @  }5 _function populate(){
- L3 d* O3 A1 _7 M% Qif (iedom){/ y& P! B* b9 A" b- n/ ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 Q  L( a8 m, W: y0 Y* wcross_marquee.style.left=marqueewidth+8! x! K' ~$ o: O2 ~
cross_marquee.innerHTML=marqueecontent
3 I4 g5 C9 J  i. i* Q+ J/ ^: uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" W. X8 N! R5 g5 P* Y( }( a, l
}$ ?* U) H! W/ Z+ {( n: E# f
else if (document.layers){; V. W: p4 s, K7 ]* r
ns_marquee=document.ns_marquee.document.ns_marquee2
: A$ @0 K. Z8 Jns_marquee.left=marqueewidth+8# M0 r  W" Z* N: N  q1 G
ns_marquee.document.write(marqueecontent)
: n# H' @+ o& v0 \; Nns_marquee.document.close(); w6 c9 H5 {% s: S* l' V) ?6 f6 w
actualwidth=ns_marquee.document.width
. J& ^. m: c+ m}
3 ^# U: A: `6 j! E  o2 k) Y2 `8 E0 Nlefttime=setInterval("scrollmarquee()",20)8 s# d5 O. n' M% ~7 _1 w) L
}# }9 R% h0 J& c' w( E& z7 {- ~
window.onload=populate0 Q$ X/ x/ o9 }5 K

' P3 }! k  J3 r+ K* p; z5 ?function scrollmarquee(){
3 C1 F- ]9 C$ C! Pif (iedom){, a8 Z9 Q9 C' d1 y! {
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); f/ X8 j$ M% F8 F9 U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 a0 B) j1 u& _+ z$ y, q% y
else
3 N) j. |! U9 A0 q& e5 jcross_marquee.style.left=marqueewidth+8' ?& a/ k) f2 g4 e% S

* c* C" w& r  d& h" s2 e}
9 Q/ D9 W) I# _' X8 m2 F6 n0 qelse if (document.layers){$ Y9 G8 [7 X" s7 ]% l/ a+ v
if (ns_marquee.left>(actualwidth*(-1)+8))
+ g) ?8 ]( F/ Y& ^1 Nns_marquee.left-=copyspeed, h8 e8 [4 r. H* D
else
$ }: }/ a! h0 W, J5 xns_marquee.left=marqueewidth+83 }7 y: f. J/ u% b' N2 O1 K
}7 g( k1 b+ `1 T, u# }
}
$ j1 n/ Z- {% i1 O. W. o' H* ~  K' x" d4 W7 {7 Z& A. ^
if (iedom||document.layers){
2 w$ c: M- _  t, ^( V' T2 i$ g& \with (document){0 w5 L+ @# i, D& a2 S4 G* s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 f4 y( S2 J4 ]7 G. P3 _0 P! [if (iedom){
0 K+ t; j5 o1 |+ `# N' w. Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ s0 Z$ R5 I6 p2 a, z. jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) g2 O3 n( l# \/ m
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ I' m- G5 r$ ]1 b7 `" jwrite('</div>')
% }7 j9 R4 [* {2 {}! y/ o- S. W3 D3 D
else if (document.layers){! Y7 z; L3 u/ H: J1 i- p1 x8 E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 [# r4 B  E7 t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ w' f' [$ f/ \7 ?, ^; a# d' Z
write('</ilayer>')
" @1 a: h# [+ X' T}5 s1 Z; m5 j( ~
document.write('</td></table>')  d9 Z( `8 T! w( {# m
}5 J+ B4 B/ q  _, `  }
}
- g8 I( U0 ]( P# ^$ C</script>

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