返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 z* K; ?0 ]. A# i* ^var marqueewidth=300) I3 b" I& p. u
//高度
( B8 _- K9 i# ~7 [var marqueeheight=25# p4 W4 n6 a9 o1 k
//速度(1-10)
; l) t8 \9 k, P2 |9 svar marqueespeed=3" H' K2 z) P5 `, `( u! ~8 r
//背景颜色) h! o  W4 U. j& b- [
var marqueebgcolor="#FFFFFF"
' N; u% Z, Q/ x9 S; ^) l" \//是否能暂停 (0=no. 1=yes)?
" e. ^7 D  j- jvar pauseit=1
) H1 n3 P! _  v2 j& ~' c2 G9 c
5 \7 F: G  L1 _  y/ @9 ?( ]( _//修改显示内容
$ |% c9 L7 G9 C! Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 V3 h+ t7 v: K+ P+ C# G, v4 l

8 \! y& \/ b) s" \5 o
1 D1 j! E! c2 }2 ]. M////下面不需改变////////////1 m6 y3 H: q6 ?$ h6 t9 g9 \' O5 J
* H' K; y& ]! N5 e5 U, @
var copyspeed=marqueespeed
. d) L5 v* `" {4 ^% H% vvar pausespeed=(pauseit==0)? copyspeed: 0& |9 q$ L9 l. d6 W
var iedom=document.all||document.getElementById
/ U' B/ d. l3 N$ }if (iedom)3 \9 w* F7 G( r0 a( Q8 p3 I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& X1 a: U( E; _7 {
var actualwidth=''
1 |/ U' ]* r  p! q/ M! D  ?1 M; Tvar cross_marquee, ns_marquee
# R  q- B3 R0 N- B( X6 w( m2 C2 e9 {4 Z" o" x# i7 x9 }, `
function populate(){% B  w9 ^, d# p2 I0 m9 ]3 N
if (iedom){
# P* o' K! ^* N8 N& }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& F% {8 r8 j# P: k9 across_marquee.style.left=marqueewidth+8
% R$ J) [% v' b' a6 Z; ]7 s% p' Kcross_marquee.innerHTML=marqueecontent
) T1 C/ @, s$ j9 b- r5 ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% D$ F, w2 d! A* x5 \) e
}; ~* M+ Y1 k1 Y0 _& _/ W& @
else if (document.layers){8 k- {$ D$ w$ V9 O2 a
ns_marquee=document.ns_marquee.document.ns_marquee2
) z3 P$ H4 s9 sns_marquee.left=marqueewidth+8+ {$ P' U. T$ `9 ?$ P6 n0 B
ns_marquee.document.write(marqueecontent)9 }8 H6 i: G5 @' ^2 d: a- G
ns_marquee.document.close()
( m# L% O) q: v9 ^5 ^; Lactualwidth=ns_marquee.document.width
3 x! V$ @  t" @}
- I; [0 w. \; j, F5 klefttime=setInterval("scrollmarquee()",20)4 s6 h' y8 x# P5 G) F! P
}
" V: r- j5 o1 w$ c6 cwindow.onload=populate
$ V4 _. ^$ n: E# H3 J8 A7 w5 }) F2 [' n! p9 k# w  b( _
function scrollmarquee(){; T- K. a1 e* O0 c4 A
if (iedom){
1 [% g/ H& d! K2 qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( x" L; b0 {; ~& C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. L6 V5 d9 Q7 Z, N: f' ~0 d
else
" D; G  y- u& P& `cross_marquee.style.left=marqueewidth+80 k5 s% t6 l, m6 J( I- r
( f. |! ]* X8 j* @- k
}
% N& `; k: P( Q% F# G& |7 v% gelse if (document.layers){
% B# u. A! g0 D( mif (ns_marquee.left>(actualwidth*(-1)+8))7 v  O) N* y4 q% |, R" g* B
ns_marquee.left-=copyspeed
  p" |$ [: D/ T: _else  R. b* i& L+ [2 U- k
ns_marquee.left=marqueewidth+8. l3 z, u% Y' r9 V  r+ Z
}: M/ Q$ I, p1 V# j; O( _+ a8 c3 Z
}, B8 Q9 Y, s; H/ d

8 R" X( ]5 A8 W; E- F) \if (iedom||document.layers){$ A; o% \3 s0 s: X
with (document){
4 l# s# E2 n$ B' B0 z2 a# J# Y' C& Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 E" A+ Z; Q3 B. q9 z
if (iedom){
9 R' @8 o) f( \4 Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& q) o8 O( m/ Z4 l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  t# O/ y, ^8 N3 S+ \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. ~) u2 J) i5 Q9 ^" v6 F( Rwrite('</div>')2 p# b% a. ~" ]
}
- Z6 o% g( P, Uelse if (document.layers){
; F& l% h1 b3 F* rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 L8 C. o6 |" {( ^1 w) z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; K% M" w# L1 v5 qwrite('</ilayer>')
$ T: |! q) ]6 M% l! s}+ I- O# N9 L  v* \; T3 H
document.write('</td></table>')
( |- v5 O; l: C. e) c& y- f! o}& ?7 G- s" S  T# `! @/ N% k
}* x5 Z4 l) H" r! a4 F( X/ H
</script>

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