返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 N9 I  @: V0 evar marqueewidth=3004 c7 l& x2 M- a" W, W. Z2 ^
//高度
' g- k+ \8 M" @8 Uvar marqueeheight=254 y: }; m& h% Y2 l. H7 f1 v* W
//速度(1-10)$ k( `8 l; F8 f2 `% _6 y: K- R/ I
var marqueespeed=3) c0 q7 ^: n7 j; L" X4 u
//背景颜色9 s, L) b! j$ }% @' j8 v' C
var marqueebgcolor="#FFFFFF"% c+ F+ r0 \8 G7 c; e; @' y5 z
//是否能暂停 (0=no. 1=yes)?, _0 D4 N7 W9 d4 r
var pauseit=18 [4 D7 h' x7 W: ~" S0 X, U; ^2 M

; ]! s/ h3 a+ F; G4 `4 J; p8 H//修改显示内容
1 C" |; r  `' p7 A3 j! L' W. Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" l) x+ s5 M7 A* J: E
% P1 m4 a7 g1 Q( ]6 M' ?9 ^: e8 \( e$ H3 e
////下面不需改变////////////
+ t, b3 Q- k4 ?% l9 B* @1 [# I9 |$ j- u0 d) T* l
var copyspeed=marqueespeed' L7 @7 n2 c% ?
var pausespeed=(pauseit==0)? copyspeed: 0
0 n' i3 u# g' y" H8 ^% c  uvar iedom=document.all||document.getElementById, j. t7 w& D6 z) L3 ?  E
if (iedom)8 E3 k" j8 M# b3 h; [+ `6 T+ p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" ~' I, w! y! L' o
var actualwidth=''
8 R, s3 R; s# [' Z( Xvar cross_marquee, ns_marquee- M; T) V: V% W$ ~6 [2 v

. t( z4 C1 Q% `' V. a1 {7 j) k! Gfunction populate(){; J: `; X2 ^1 r9 W, \
if (iedom){$ X( t2 O' m- O" f% W/ l% U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 A' V7 E, c) W, @1 ^& Kcross_marquee.style.left=marqueewidth+8
( b5 M& \0 N' M- Q$ Ycross_marquee.innerHTML=marqueecontent$ j' u9 h, N. ^4 x. }8 O- s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 d4 l9 Z; G3 y, d' a& P  B$ s}
4 g! w! B5 X/ Q) Ielse if (document.layers){/ z$ @* {/ Y+ U( p& b" i  Z0 t
ns_marquee=document.ns_marquee.document.ns_marquee2. E$ y  u7 ]! v' e/ c; X( m
ns_marquee.left=marqueewidth+8
( |- u! Z: A: n4 d% R7 i% pns_marquee.document.write(marqueecontent)
" X# [; D7 s( M, Q* d: |) qns_marquee.document.close()
% s' y: G$ b7 _5 t$ @7 C) Y# }+ Wactualwidth=ns_marquee.document.width
3 l( \& x; D" ~) R}
' a& Q, `4 v* ?4 l- x  @lefttime=setInterval("scrollmarquee()",20)0 @. P' P$ W1 X" h5 w
}
* Q& Z) d3 s$ ]6 r) U4 E& N, kwindow.onload=populate: n- i' v% |/ h8 G6 ~

! v/ ^6 h- O& }: Y. Kfunction scrollmarquee(){3 o9 E+ J" ?" ~  @
if (iedom){( J2 ?4 D/ L1 s: a& X: c
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ }* t5 d2 |7 l3 q2 A6 j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 W$ {9 C, d3 J
else- G7 s) s! z' B6 b- L6 K* }# L
cross_marquee.style.left=marqueewidth+86 q( c5 d1 @& Y$ n% h$ X' h/ Q
' C+ a4 H5 z7 Y: U" Y  R
}
" {* w2 Y- L  telse if (document.layers){
) H6 D" B/ E, s% c( K& vif (ns_marquee.left>(actualwidth*(-1)+8))
' ~6 Q. Z( L% M+ e1 B0 x. nns_marquee.left-=copyspeed
% O2 g3 Y* _4 H0 }+ j& jelse1 }! h! Z- G% I+ J& Z( k" z9 S
ns_marquee.left=marqueewidth+8
0 c2 G% j7 C4 Q& h3 `& j& n/ F}
& j# C0 Q# p5 I/ V}/ v5 y3 h6 ?" s. |/ }% t" D
6 M: o1 U5 i, G6 w
if (iedom||document.layers){) p" U; a5 A* f, C6 `
with (document){. a; q3 B7 U$ l$ [. B, U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  B. K% @6 p: i! z
if (iedom){
) j- r- t5 b! }7 A/ ?9 jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 M/ C) f( U6 {7 t4 K
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' V8 j, F; y4 [& F* S( f0 ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 s1 ?+ J7 i% m$ q* j) O- g% Vwrite('</div>')$ c5 y- A+ \( w) A* f9 F
}
) N: d6 _  G0 `$ celse if (document.layers){
8 ]. f. d' X) K& @) Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. {& B+ l- A( iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 L5 N1 X" @* {/ R( {2 J8 G
write('</ilayer>')
6 F( [- d" S1 R  t; f}
" i2 R1 q1 O5 }9 Qdocument.write('</td></table>')9 X6 I# K9 M6 G/ f8 N/ k: U( @
}
2 T) S; j- a- ~! p4 D6 m4 ]}; L; @; `3 U" v/ g
</script>

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