返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 \# r1 q  I8 l4 J# w/ Q
var marqueewidth=300
: v. {6 `$ e+ P. C3 j$ u//高度+ }" _3 w% F+ t0 q4 O
var marqueeheight=25: x* |  s6 T6 b3 L) b! V+ l, ?  S2 B
//速度(1-10)
' M/ Q# u7 e- |9 N. L) qvar marqueespeed=3
& v) O! u4 s# Y4 x( ]7 M//背景颜色
* }, j" o" B8 e$ a9 J: ^: mvar marqueebgcolor="#FFFFFF"2 y  h0 X# G; j( x" T  a/ _, C% B
//是否能暂停 (0=no. 1=yes)?  D# N1 u- x4 ^( _
var pauseit=1
4 |, Q) ]# J8 m. m6 i* R4 [1 Z1 [6 M" @& r* j
//修改显示内容5 @5 |* }2 D  P  H% s. G7 ^* X9 S
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 `& t1 S+ o7 \  k
7 e! x9 |3 v9 q6 a
! `, |8 U$ S1 @! Y0 B5 q
////下面不需改变////////////& Q( L! ]+ V, E$ A
4 r& L9 y. P  O1 ~( R! v
var copyspeed=marqueespeed' d' w( }) n& H& o& Q' j1 A' V
var pausespeed=(pauseit==0)? copyspeed: 06 k4 F% x1 r% P1 N4 M* O3 T
var iedom=document.all||document.getElementById
4 ~$ Q4 i  d  B5 m' ]& Jif (iedom)  E7 P" }9 w+ Z1 |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 N0 p- _4 t3 m0 n- @var actualwidth=''* Q; f& W" M4 W1 e) K* X% Z# x
var cross_marquee, ns_marquee
; B4 J' r0 b/ w0 ]
+ t7 ]9 s. o% Vfunction populate(){' y: c9 F$ k: T2 a! x- d
if (iedom){
$ F, g! [. I( H/ Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: \3 C! [% Z4 N% V' w, Zcross_marquee.style.left=marqueewidth+8, `! [: A, }1 P9 [1 N5 _
cross_marquee.innerHTML=marqueecontent" ?$ U! J* D! [8 I- B! u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 b3 U' ^2 ~5 z5 f}
; V9 ^5 Z, [4 j( X9 p3 D2 x# Belse if (document.layers){
( b! X$ k0 l& Bns_marquee=document.ns_marquee.document.ns_marquee2* i) f' R5 d! \# U+ M8 M( n- u
ns_marquee.left=marqueewidth+8/ \/ E3 O( Y/ |/ C, }
ns_marquee.document.write(marqueecontent)
, ?/ r( ]0 T1 J8 j1 l  ens_marquee.document.close()5 b( h1 v2 r: ]: m+ c9 Q& v8 D8 y( O
actualwidth=ns_marquee.document.width
: e9 X+ P/ |$ \8 P9 K8 `' g* ~}
- x1 \$ f! }) f6 }" z3 [lefttime=setInterval("scrollmarquee()",20)8 x; O3 Z3 q0 Z
}  f$ q# {" Q9 ^' w4 e. W" @, r
window.onload=populate
3 o- ]8 r7 D4 W8 |3 G0 \' H" j, Y/ i; M9 M
function scrollmarquee(){
. l$ u1 }2 F7 h3 O0 N; [% e; A1 Yif (iedom){
1 N+ o" D+ G9 z4 o2 Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 S: u5 t7 e; L, ~0 Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ T$ l% h) a; I5 l+ ^else7 q0 ~/ [" G; _/ b$ C8 @# B
cross_marquee.style.left=marqueewidth+87 Q4 D0 M4 H9 u: v$ @+ N

) A  o7 K; `4 e1 F}
* c* W' U% O4 A0 m# H. @; F( Lelse if (document.layers){
' `7 Z) o) t- H% I+ ?4 w0 A. Vif (ns_marquee.left>(actualwidth*(-1)+8))
( Y3 i7 q! }: L+ Tns_marquee.left-=copyspeed
* q0 q1 }6 j6 Q0 K4 b( \else
. P! X7 B& o$ {ns_marquee.left=marqueewidth+8* D5 d( }" U: }/ a$ m1 |2 J* d) _
}7 k' \- z0 h( c2 g4 Q8 Y
}5 a4 g2 P9 K) p1 S% ?

6 f; t, }' v0 o9 Q6 wif (iedom||document.layers){7 A! h& ~  S0 g8 J2 R$ {( ]' V2 r
with (document){3 S- t$ n4 x. v6 T7 `# W" K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( d2 R. Q! p) ], e( u6 a
if (iedom){% T; ]3 ]( I, r+ T2 O5 [  L; X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 B/ C4 L$ E: F% P, f+ [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ |: q/ A- P! r+ f/ o& F
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 P# T) H2 }& N8 x( F  F- |+ T+ Z
write('</div>')
9 j1 f# n7 C* \. J, C7 n0 C/ j1 o! s}" k/ C  s8 [" Z# Y) P
else if (document.layers){
$ E; M* B, i2 M( Q# D# Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 E/ N' h& N2 o
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- q; G/ ?/ g! P: B5 i
write('</ilayer>')
  O- m( X$ P7 |}: `$ D; ~  j+ X* t
document.write('</td></table>')
. Y+ C! V/ l. x6 u* d2 ?! R& l}( F3 M5 ?" y7 `( J+ d6 @6 o: a9 K
}! C3 i2 W7 n9 T% M
</script>

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