返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ ~; k6 R- X7 W5 u! b/ ?* f
var marqueewidth=300; ]! ]( X. @% T6 o
//高度
1 i9 f8 b- B+ _  x" ~var marqueeheight=254 b* G9 Y3 b' Q* V. a' ^: \8 p  n
//速度(1-10), \' X3 k# M9 y) ?
var marqueespeed=3
( I! Q9 U9 g+ n/ M/ W7 R' g//背景颜色
" g4 \! _+ }: f7 [( ]% T( s" B9 Fvar marqueebgcolor="#FFFFFF"
4 D" }# H! p- p! r0 G; Q. `  s//是否能暂停 (0=no. 1=yes)?
$ Y2 P4 y+ a) y! r, jvar pauseit=1$ c, C/ _: y" @( S! o0 P0 Y

9 x0 |$ g% c. ]: K5 s$ s//修改显示内容+ B% x* p% w& T3 Z% u2 r+ l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! [% |3 k1 m0 i  d9 o( C
- {) M- J$ Y1 n

9 h* y7 a' ~; K9 e////下面不需改变////////////* u# z- Y: m7 ]* z- [1 ~
) \$ X) \' E) _- p( r2 K9 g3 P
var copyspeed=marqueespeed
- L3 A6 P4 s4 H! |% U& x( ?var pausespeed=(pauseit==0)? copyspeed: 0
( ?, p/ N4 t! Wvar iedom=document.all||document.getElementById: a! t' z. J( A6 r& j  {/ I
if (iedom)
) |& u3 |/ H) T( Udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 |& G6 `- \0 \1 n) m8 evar actualwidth=''
- \4 i& n9 I, u' V: Uvar cross_marquee, ns_marquee4 y7 l+ u3 g; Y! ?

4 a% e+ P& J) T! pfunction populate(){
7 E: ?& n" y# {3 m% ]" f% a% }: \if (iedom){* t/ o. _# J& Q/ C* `' f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& |% N, K! H6 O/ w; H; T
cross_marquee.style.left=marqueewidth+80 b8 h/ c9 V# A9 p; x0 }
cross_marquee.innerHTML=marqueecontent' R6 _4 x0 o4 c  T% {! P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, T$ P, A2 C/ S}( z# D' n8 c3 A7 U* e# H
else if (document.layers){
  `- n6 t) j: b! L6 ~1 N; |) m; Wns_marquee=document.ns_marquee.document.ns_marquee2
7 p" D9 z2 F+ S/ X0 |5 V) S: D6 qns_marquee.left=marqueewidth+83 j* F4 o' I4 w6 m% O* b& |' y, N
ns_marquee.document.write(marqueecontent)+ B2 o6 w+ J" l! k
ns_marquee.document.close()
$ d- d+ I# G, E# i" q  S* }actualwidth=ns_marquee.document.width
8 K& W+ a: \1 k7 U+ Q}
) g* V! W2 m0 W1 ?( ?lefttime=setInterval("scrollmarquee()",20)
# C( N, v) N! q$ z# X- y}
+ ]$ V. x" p4 r# A- z2 [6 awindow.onload=populate
/ K0 N, c9 b) x  q
3 d2 t3 X2 ?5 _& mfunction scrollmarquee(){9 k. Y; n9 R$ z0 Z( l+ s! J% x
if (iedom){' k/ D/ T9 Z  ]0 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# O; g" ]- t5 z/ v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ D6 t" L$ t8 Ielse0 V9 L6 l+ s, ?: O7 R8 O+ |
cross_marquee.style.left=marqueewidth+88 `4 V. A/ ]; P# H! G9 S
4 B  S  T" Q' U  o0 I
}: P1 b  O. J# a* |3 @2 N
else if (document.layers){9 w9 N) G# s4 i7 X: ^1 q
if (ns_marquee.left>(actualwidth*(-1)+8)): ^. ]. o& z) N
ns_marquee.left-=copyspeed% R* ?$ w1 b2 N$ p( h; \3 o
else
$ t2 K' b9 q# ~- _, @& xns_marquee.left=marqueewidth+8
! ]& V; p. X% Q% l}
; y4 w3 q$ Y9 g' |4 J) P- f}% h6 @4 C. Z; I5 B, w

8 T- p; h1 ^$ [if (iedom||document.layers){
( ~. M7 Q5 |' U% F$ t7 q$ ~with (document){
4 N1 Y$ i* {0 bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 E0 M& X5 j; `, J% l9 q
if (iedom){- V) Y+ l' B1 y! j4 S0 h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 U1 U. t; i# r! Q* R  `0 K
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% ^  t/ U9 u- {4 dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 S7 f1 F1 ]7 `" W" M3 u% O
write('</div>'): C% |! @' A' K! N& e4 _! a% y
}3 v- n2 T/ t7 j, Z) D4 |, J
else if (document.layers){# B* E$ \* ]5 y9 }1 U$ x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' e3 D9 ~0 l8 }! xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ S' O% G4 I2 l) F- @6 Nwrite('</ilayer>')0 m  h1 a: G  f& }
}; {# E: B; n; F+ a
document.write('</td></table>')2 o  C  M7 B) G5 V- ]4 c% r) l
}3 l1 d5 x/ N) ]3 F9 A3 C
}+ i5 _7 v" R0 ^9 Y4 J9 Y
</script>

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