返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% _- T! Z" Z, G2 e8 J% ~var marqueewidth=300
0 \6 A  Y* P- O) H//高度
/ t0 q. u0 L3 N+ m; h7 L; g$ Hvar marqueeheight=25- w1 d. U! s2 {! N) ?5 y& u" }1 l
//速度(1-10)
, b3 j5 N. O% rvar marqueespeed=3  q. e; P4 d, T! D5 C
//背景颜色$ N5 V$ c0 [( z4 E( Z
var marqueebgcolor="#FFFFFF". }# w: J! B/ o+ R2 N
//是否能暂停 (0=no. 1=yes)?4 x$ O0 c2 S. A5 g
var pauseit=1
' y5 d3 ]( \) B7 ^4 M) N' c" L" A" U+ U, b7 i
//修改显示内容4 N" i9 \9 p! c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ Z! c: O( x  l1 q9 y: a1 m* W
- x6 \+ r: @- x/ Q
" d5 J% B& B' s5 o6 l% x+ q: h
////下面不需改变////////////& S1 Z' k' ]: i! r% b( G
5 d- k* b9 A5 e* `7 d7 D5 I
var copyspeed=marqueespeed
0 ^5 h; r, r% d  \var pausespeed=(pauseit==0)? copyspeed: 0. J/ r1 L2 S3 e5 Q. V7 s
var iedom=document.all||document.getElementById
5 M* n3 m* h) L. s$ p+ Z2 s( Bif (iedom). Q7 G" w1 @1 \9 W* J3 L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 g& N, a6 t4 Q
var actualwidth=''
$ t, {  G6 c1 [0 i$ ~var cross_marquee, ns_marquee
3 z2 [; N2 m9 N2 Y# ~4 O4 n/ a; k5 M: r# c
function populate(){4 n- b$ @8 O2 F2 I: x! [: J2 A
if (iedom){6 B  g/ X8 e) b3 r' Q" n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! d5 w! b3 P% S
cross_marquee.style.left=marqueewidth+80 ?0 V" V4 E+ ?6 ?. O7 j. {: u
cross_marquee.innerHTML=marqueecontent
& G2 d% f* n+ s: a' I; @) X) r# Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! T1 E% f/ t5 y* |5 I. d" V! e* h- S}
, q6 n, v/ {6 T8 [3 belse if (document.layers){
. Q3 M" ?$ K  \5 e/ A! |ns_marquee=document.ns_marquee.document.ns_marquee2
; ~- [* w' M& v7 }' k% ?ns_marquee.left=marqueewidth+8
) [4 S2 Z( B1 P' t" v% N" g* s- xns_marquee.document.write(marqueecontent)2 l8 Z3 }8 {  L5 y/ m8 }- t& ]5 t
ns_marquee.document.close()
4 @/ V8 M9 @: H0 n# T5 e0 n% ~actualwidth=ns_marquee.document.width
  @6 s9 c& C4 }. O}% N/ V. z; _7 h
lefttime=setInterval("scrollmarquee()",20)1 \, }# o! y* w: d; P$ Q9 f3 W
}. g3 f  g& P7 C+ [* `
window.onload=populate
; K% U: h8 A" R4 M! M- v) V2 ]/ M0 S1 r5 R
function scrollmarquee(){
/ ]& S; X9 H$ z; x# O) Jif (iedom){
' K, K% l+ p0 o" v3 l; y1 tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% F6 C7 `( X! m+ V, s9 E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! z+ N  \! A! @  H1 x% Celse: U' u( G% N4 ?$ J* \; c* d
cross_marquee.style.left=marqueewidth+8
& s; f; B, M$ v$ F0 _) W+ |2 @" \& \3 M  I7 g) _
}
1 `. m9 \& P3 t, Zelse if (document.layers){
- G( h( _- S. tif (ns_marquee.left>(actualwidth*(-1)+8)), ~# }  f# e/ K" l: l' _
ns_marquee.left-=copyspeed
5 ]5 S1 K7 b' |! B- }else5 d4 R# C6 H8 j0 [& y' E
ns_marquee.left=marqueewidth+87 Z' C: `) |' s5 f
}
# {, w% D( E' y6 u2 w- Q  t* R}
* s( K9 m" h! p" T7 W" \# |% {( d; I. ]' Z/ W
if (iedom||document.layers){
+ q. h% k+ r8 P9 vwith (document){6 K8 R$ Y  M7 W0 A1 w; u( ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* U, K/ l) x% d
if (iedom){& c& ]- W) Y6 |8 z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 B0 M) G$ }  @" V3 b  q: [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 _2 z1 @7 n+ U5 N; u1 c- c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& W1 s" M. t* W  }- z8 N$ a
write('</div>')
- ~8 m1 _5 W% `+ m- ~. T- j}
# B. j; P& J9 a2 Z+ }7 [else if (document.layers){' t4 s) j5 P2 H$ ^2 _% g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( v2 `: j+ h9 Z9 ^- Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ z8 H* x* Y) z, wwrite('</ilayer>')
* J4 M: B" g; v2 a1 T$ k3 ?1 ]/ H6 [}5 w5 b1 h7 ]$ `/ Z  V, N
document.write('</td></table>')
6 Z( g% s# y$ D) B- _0 h$ e% f! p}7 X8 ?% J4 J& Q" q
}
4 G' N, {& w+ F; Q( r5 T</script>

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