返回列表 发帖

网页之跑马灯文字特效

//修改宽度# Z& z& u- j; j( W
var marqueewidth=300
9 B" g5 ]3 |+ l4 H+ J$ T& c3 v//高度
- A4 j8 W! z1 H4 D8 Wvar marqueeheight=25
, I7 _; Y; o. f/ {//速度(1-10)
6 l5 v7 I# v8 H3 Q: G6 tvar marqueespeed=3
7 s- e) Z+ c( s6 C/ x9 Z' a# I, ^//背景颜色
! C' A& r1 s" Q+ k+ G+ uvar marqueebgcolor="#FFFFFF"" k! I) o" [/ \4 F! }1 V& T' {
//是否能暂停 (0=no. 1=yes)?) n4 |6 F+ p# T1 ^* b- i) i: x2 L5 f
var pauseit=1
4 b9 ?& u" g1 u3 Z& \, N- O
8 `: P& |7 K: a; M//修改显示内容
9 N4 G- [9 Q3 u; u. ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', Q9 Z+ b8 ]9 L5 ~
, H/ }* B5 ~+ C+ p0 j9 \

0 u4 ?1 M) {5 d& c0 l////下面不需改变////////////) r1 i" U  k- T6 x0 d$ x/ k% p

4 M6 A6 i5 ?/ T0 zvar copyspeed=marqueespeed
" x; K) Z# E0 X# m2 i& l9 Lvar pausespeed=(pauseit==0)? copyspeed: 0
. X7 n* p' ^2 Q7 T+ Pvar iedom=document.all||document.getElementById
0 P8 V7 e$ j1 U! x: [if (iedom)' h7 n6 }9 {/ V( G2 H* o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" `; x- _% m& ?- Y9 |, Q$ Uvar actualwidth=''
0 Z' _+ H0 V) e7 i9 Y% a; Kvar cross_marquee, ns_marquee0 z% R. p7 ]9 C/ e

7 h) F2 S$ O5 h* Kfunction populate(){
% k6 B9 L. j  H  A2 Jif (iedom){; C: X# G/ x8 x  C  d" t3 e8 F6 X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 `7 e/ t; v+ r
cross_marquee.style.left=marqueewidth+8. [! t( C$ ~0 G( D! X3 M/ {) v5 q
cross_marquee.innerHTML=marqueecontent
8 [5 O- ^7 x3 v1 `( Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 X+ H% e/ s  s" W0 n
}: j+ z7 ^5 R1 E% e$ s. x, W4 o
else if (document.layers){7 [0 n9 i% Q  _/ h
ns_marquee=document.ns_marquee.document.ns_marquee2. w7 `% y# i! I, b3 s7 C
ns_marquee.left=marqueewidth+8- L& r: ?: P6 z) i+ Y/ ]0 P! Q
ns_marquee.document.write(marqueecontent): C' }( G9 z4 O: W$ N1 ?* K7 B2 ^, O
ns_marquee.document.close()
% i/ t& Y" \' C: Z% _* g0 E/ Q! Pactualwidth=ns_marquee.document.width
. A) Z( L. o& r/ v" t}
/ M' R$ T" R3 F9 _7 ilefttime=setInterval("scrollmarquee()",20)8 `- o" J- g# X2 \2 F- m! e
}
+ l$ P- _, a: j/ i0 P$ Cwindow.onload=populate
& ?+ H) J# j1 H  p$ s, E1 k  Z/ f4 B9 y! w% _9 d' r* D( D3 f) s  L
function scrollmarquee(){) K+ t0 F3 d4 V  Q0 u' u
if (iedom){
& s6 k; ]5 j) Q4 y6 D6 tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% b! f7 J+ N2 I3 S2 H0 o, Across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ r# w4 ?$ `4 ^* B
else
* s  \( s$ i& _) w! dcross_marquee.style.left=marqueewidth+81 E/ J; z6 Q& z3 T* H+ k
  }3 X$ c1 z. \! K: q  F
}
8 t9 f; \5 L; n4 p' |else if (document.layers){
1 Q7 e1 \8 h! m3 f. X, c# Yif (ns_marquee.left>(actualwidth*(-1)+8))
+ f$ ?# C8 Q' J3 E4 ^' M3 B2 `ns_marquee.left-=copyspeed& \* f4 k. g2 c; r1 t7 H% S
else
) a& ]$ }' W8 x6 \ns_marquee.left=marqueewidth+8
" r- Z: r8 E$ N' y6 a. H: K4 K3 G}
+ n0 ]3 k3 Q  _# e}
' m& ]& ^+ [9 f9 E$ |9 G# D) X8 H! a  V
if (iedom||document.layers){
) J! ?" ]% P0 j& I0 ?. owith (document){
! E, u% M+ R1 c0 s3 \. Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 a7 k: D* z2 p8 X) m/ {  O2 o& D/ y- |if (iedom){( a* [) K* n( o$ p0 i. s
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& Z" }- T# Z9 @) j
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 A7 |, @! U1 P( `3 g1 ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, ?/ r! B- K& O( v8 Y8 Jwrite('</div>')
1 t$ p) b& A5 R* p6 Y}
) G9 q  V* R: ?$ l7 y+ B+ Melse if (document.layers){! c0 z( V& }. Z: c" l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ t9 I8 N7 m2 R. `- L& H7 n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ ?$ `1 U# o; a* ~: bwrite('</ilayer>')
: l& U  y. Q' C1 A" D1 r}/ O( b3 j; M( Q4 V) b! `# J9 {
document.write('</td></table>')
" R6 y! t- |+ v+ C0 j  N1 U}
% j  r" e3 ~- o  [* r6 M: ]  W}1 T8 _) s" v) w* n
</script>

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