返回列表 发帖

网页之跑马灯文字特效

//修改宽度" I4 @# Z" H& H6 ~/ u% Q* D9 k/ h
var marqueewidth=300
. h0 V: u. b3 Q- K//高度' i! U: y& I( ]+ b% p6 e7 V
var marqueeheight=25" W4 @3 J7 s, E6 T
//速度(1-10)# V( \% l- V4 R, |+ L: L
var marqueespeed=31 G5 O3 A" O5 y4 h
//背景颜色
! Z2 ^* P0 G- l1 `4 Ovar marqueebgcolor="#FFFFFF"/ r+ w# U1 T9 d/ J
//是否能暂停 (0=no. 1=yes)?7 U6 [/ a, x9 d6 C7 I' X/ X4 o
var pauseit=1" T# w* [2 F3 R4 h/ d

9 N" }9 X; ]2 R/ {1 M//修改显示内容4 @- W0 N4 M6 O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* Z, s5 P9 l. n8 e3 F2 \. t

6 e2 T6 {9 X1 b) B( _& L
. A/ ?0 N3 t) ~1 P% f( ]) R* P////下面不需改变////////////- k  o) B" V: z& @2 h( F' \
7 z$ L$ c1 ?( P7 A
var copyspeed=marqueespeed# \3 J0 t0 F6 X/ O5 |" U
var pausespeed=(pauseit==0)? copyspeed: 0: q- S; \& t  W+ g
var iedom=document.all||document.getElementById
9 G! o: R4 |/ T3 `9 Bif (iedom)
7 n; ?! T* P- f+ H3 `* ]4 r3 Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ u4 K. B: Z* S0 \; S
var actualwidth=''+ f7 _6 p* c8 x, l) D; U1 Q* v7 d$ M
var cross_marquee, ns_marquee
% l- g$ x* |( B, U6 l; K
/ t3 f+ o9 Y, t* Cfunction populate(){% \$ F, N1 [2 a* r) q: \( n
if (iedom){9 |* U% Q8 T9 \$ L  \# a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' B3 W: b+ P: o$ c. l9 t* \
cross_marquee.style.left=marqueewidth+8
0 ]' E1 D. y+ y6 {+ r5 hcross_marquee.innerHTML=marqueecontent8 l, m! d' r1 M5 o6 ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* ^$ k! m5 R' B0 h# w+ [. C; W, B
}
0 ]+ p, t) Q; b- Welse if (document.layers){
0 W% _7 N  g" W- W" k( q8 V; P; vns_marquee=document.ns_marquee.document.ns_marquee2
# x" ^1 z+ o1 w$ s0 ens_marquee.left=marqueewidth+8) E0 ^+ ]7 L' L; E+ e
ns_marquee.document.write(marqueecontent)
2 b1 `9 c" u' S4 q7 B1 z5 a% fns_marquee.document.close()
3 g9 _( P. V2 [. y% J3 i( A* Gactualwidth=ns_marquee.document.width/ @1 X, L- u" q( j; h3 t& P8 r
}8 V5 O) G  q, }, N, c1 V6 W) F
lefttime=setInterval("scrollmarquee()",20)! Y- p& ?8 K6 G/ \
}3 f2 Z) h; X. {
window.onload=populate0 ]  q: K+ S( ~0 }
8 v6 U/ {7 y/ ?& L) i
function scrollmarquee(){2 T9 ~  \+ R  v6 C. |" ^
if (iedom){0 x# a: X) x4 F8 l( s$ Z( c
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  L5 W% o$ L0 x
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 v- S" s) ?6 @! T: V# I; O1 I$ ?1 Kelse
* M% j7 W4 h( Y: M& j% Kcross_marquee.style.left=marqueewidth+8# ?* {4 y5 Y) q( T

! R# \- T. T  S8 K$ J}
  I8 \% B1 a/ }. [: Helse if (document.layers){
- J" {* S- ~1 s7 ^3 nif (ns_marquee.left>(actualwidth*(-1)+8))
" S) W3 n6 K7 i3 xns_marquee.left-=copyspeed' \# U7 H8 K5 @. X
else
2 w* P+ c  ^% m  D6 L; r' hns_marquee.left=marqueewidth+8
7 B6 L0 x1 M! W2 f: N; H}0 B/ K4 x& G7 [6 m
}
; z3 r! \4 L; `# @  e
1 d9 Y+ L: J% Oif (iedom||document.layers){' K. _5 \+ k0 U: J
with (document){
: l4 r6 c/ A  S( _6 h4 U. F) Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 q2 ^2 O; p* f3 B- Y
if (iedom){3 E4 `: F3 F% K: ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 C5 |$ _, b% q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 w6 F" K. ^* T$ D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) s- q" @- w2 t5 ]9 t
write('</div>')
. m  k+ v& x6 P}) H( c% T1 j/ T* V* }7 x
else if (document.layers){
) ]# Y' i' H% @2 W* r# Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% j& t8 ]4 e* Bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 Z8 W2 C; N. R; O2 n( g
write('</ilayer>')
. ?; f1 y0 J" V" I4 K; L( C}" P* i% {! A# [( X  W: M# }+ a
document.write('</td></table>'); g$ D6 e4 m8 k* f7 o3 Z1 F$ S3 F
}. s8 v( u2 M; T$ q
}) N% D5 P# r# s+ m; o1 B
</script>

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