返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, f3 K% p/ Q6 bvar marqueewidth=300
7 @7 d6 @! f& ]$ Y9 H7 h% S//高度
: ?! s( J- f( [var marqueeheight=25
' G6 n2 V3 P2 D; w//速度(1-10)( l' Y4 \7 M' q; A& e
var marqueespeed=3
- Q1 W) J" ]4 x//背景颜色& H0 H' P8 J- r$ u8 k8 e4 h
var marqueebgcolor="#FFFFFF"% A( Y8 E: @. N5 V/ A  c, r+ J
//是否能暂停 (0=no. 1=yes)?- Q( j4 F; d- \: k! Z+ Y
var pauseit=1
1 x" m6 ~2 D' N# @$ w8 F( G' d; Q- w, U0 L: \9 J* W
//修改显示内容
& P1 D* L" t$ w, jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 K* H9 }0 {0 @  p6 O% B  `7 ?3 Y) Q* R' f( N; H+ o3 O; p
# L& T! a/ l* v. \$ J
////下面不需改变////////////
) ?) _" X. R' u) s' W3 P7 Q' w" y
var copyspeed=marqueespeed
/ D7 \  s3 T1 K- n6 V: b4 ^; Ovar pausespeed=(pauseit==0)? copyspeed: 0$ b, H6 S3 h3 O) y( \
var iedom=document.all||document.getElementById
2 z  a8 g4 `4 v) cif (iedom)
+ v" k5 s. ?! A: odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 ^7 D8 [! ~* d: d- S
var actualwidth=''
; e" x- g6 }1 P7 s" |  avar cross_marquee, ns_marquee
6 Q! P2 B' g! o: j* u' y: @! A. F2 {  X2 h; h& T7 G( q4 Y
function populate(){
. h3 G; V  ^: U% W* S* w3 k9 S- Wif (iedom){$ w+ {9 s) `# r* [, f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 \6 T0 O' s# V* R" S( Z5 mcross_marquee.style.left=marqueewidth+8
+ W0 Z) \* ?* J9 dcross_marquee.innerHTML=marqueecontent: I& T" @# r# Z  C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: _) m! J' C) w/ C/ j; ?2 s) s}6 w, U& F2 n" t7 T0 E
else if (document.layers){
/ E6 @. q- f5 Y7 l: Gns_marquee=document.ns_marquee.document.ns_marquee2
) z9 @; K* r+ [! \ns_marquee.left=marqueewidth+81 h1 N/ l. I  Q: Y  a- q
ns_marquee.document.write(marqueecontent)3 x. x# b: K1 q# Y2 U3 N, r4 v
ns_marquee.document.close()# q1 k& Z3 W7 a6 z7 X, _
actualwidth=ns_marquee.document.width
$ s' Q1 J" N& I}  M$ o$ S% S: \' T: A4 O
lefttime=setInterval("scrollmarquee()",20)
) U* \# {$ P0 U, j* V3 |}
6 }+ a- K+ ], h, owindow.onload=populate
4 X; E# f$ u& D0 U9 _4 x; s7 U: p9 g9 ?! D; V5 x/ P$ t' s1 t
function scrollmarquee(){( n3 d. d  s/ ^- D  b' K- @+ b6 l/ T
if (iedom){8 k8 z: Q% |9 K; ?; y+ T
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 q6 S4 c, @' r1 G, R9 s0 Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 @5 X6 y/ u7 V( [% V% G/ y1 F( p7 }else; J4 ?3 {; x& ~! p+ C9 `5 ?
cross_marquee.style.left=marqueewidth+8' h9 V' q. C+ \+ _3 v: `& K
* a& N' O! ~4 J$ @4 ^+ v
}4 I' |: Z  I# X8 F
else if (document.layers){
2 l" [0 Z/ T. s& U3 T* Lif (ns_marquee.left>(actualwidth*(-1)+8))' y' p5 Y2 K  d: Z9 v+ e( U
ns_marquee.left-=copyspeed
0 i; ]5 C, ?; _5 }6 Helse# k1 }4 S7 |& G9 _8 j: P
ns_marquee.left=marqueewidth+8
+ [/ T! ~# Y% p) O; E}
! C, t' X+ y6 ?( n! g) D# }}
5 m& ~, v' K4 i1 S5 V% V8 T
/ w# t: q4 G: P7 \8 L, {% r3 N$ nif (iedom||document.layers){' C' r: i6 ~1 y3 Y" q+ ~! J
with (document){6 I8 p6 n9 W9 v7 S& C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- X2 M/ Z9 j5 m" eif (iedom){: j/ E# {7 M  G5 E. \- v& e$ C6 ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ k( n& ]* K# g2 L8 M
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" J! w! P: W4 r4 @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  g/ {/ W9 j& T( P" y
write('</div>')
" E$ z6 o# R' d- |& L  M2 N2 X}# G5 B' ]& ^. L9 S  n
else if (document.layers){" q/ E0 `6 N# w) [3 z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* M6 s/ k3 m: W6 W1 J0 z, `& o0 x- wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) G/ \+ P1 P9 {0 g0 G3 G4 c$ |/ \write('</ilayer>')
! b( m) n) K: Q  |+ A}9 i' w6 v8 W& v+ h, q
document.write('</td></table>')
7 \4 }% `. ?6 q* x- d* U! S# T}2 }/ e9 L0 X5 d3 ^4 {
}
! I) v& L" _" \- e# O* E</script>

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