返回列表 发帖

网页之跑马灯文字特效

//修改宽度: Z( d: C* e+ S" L( B- P
var marqueewidth=300# {; i* x; L1 J$ v! L
//高度/ H- b4 ]$ e9 L
var marqueeheight=25  X2 G' a, ]  Y6 H
//速度(1-10)( q2 ]" ?: r2 \( t8 l
var marqueespeed=3
1 N, Z; F, ?! A//背景颜色
5 Z- V$ ^* o6 L4 I: ]  kvar marqueebgcolor="#FFFFFF"
2 J0 m* t* c; e* B* ^8 }1 ~: e: g//是否能暂停 (0=no. 1=yes)?! a# O  \& d; T* r6 ^3 b- _
var pauseit=1
( y, T1 t6 s. T: @# o8 |8 J8 E
( V8 ]) V  A& z; I% L+ ?( }//修改显示内容7 C6 ^5 M, ?# R! a" [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' N, J/ z; R3 Q. Y( d1 H
) }8 T( H1 [5 N, x
8 r* h" G. Q; Q////下面不需改变////////////! F7 e7 o- n$ G/ B; H/ j  _

( J5 L: V$ W, `) D, u/ dvar copyspeed=marqueespeed
) b1 x1 _' E8 i% O5 w/ c8 t9 Svar pausespeed=(pauseit==0)? copyspeed: 0
$ L' [9 m/ {# S+ n1 avar iedom=document.all||document.getElementById
/ Y# ?6 q% h0 K+ q( sif (iedom)  }$ q+ }" N4 s1 N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, e, \& j* W8 Svar actualwidth=''
4 d. d# S7 W! t/ c7 V: G0 pvar cross_marquee, ns_marquee
/ c. q% q" c( ~+ H9 U  D) T0 y0 c3 Q9 I/ ]  D/ N
function populate(){/ Q4 E' q. ]% O4 T( e
if (iedom){6 d' U6 ?# I, W& ^" D5 g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( U1 a; e" J! k- ]5 H7 H7 Qcross_marquee.style.left=marqueewidth+82 g" N* i8 l7 L# O
cross_marquee.innerHTML=marqueecontent
2 P" N  J* P  v0 m) _* Y% S' Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 r4 ?4 y  ^, X  W* Y; f
}0 G' n. L9 b, B/ g  f+ `2 f8 Q: O8 \
else if (document.layers){
, z4 q, z3 I) h2 x4 Fns_marquee=document.ns_marquee.document.ns_marquee2
, H& d4 v( }7 U7 N( {( zns_marquee.left=marqueewidth+8
+ i1 v7 t8 C; x) I0 x: Yns_marquee.document.write(marqueecontent)2 k& Q7 @: {: S
ns_marquee.document.close()/ S1 |  `2 ~; Q! P9 ?" b. O
actualwidth=ns_marquee.document.width  ~" w2 `# {3 ~  U' I5 d3 _
}
5 W4 s" b" }1 J* l5 g) blefttime=setInterval("scrollmarquee()",20)
* \7 F; m8 H* u( a$ w}! Q) }4 Z1 L+ |
window.onload=populate4 j7 U6 D$ G- ]
8 t  E5 V; B+ x1 Y4 g1 n
function scrollmarquee(){
' V, \! Q3 t" x. N6 p" o5 \! Pif (iedom){" ~% f1 {0 J. G2 Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# s3 q+ \6 A8 ?" Y' L0 |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; C( J5 z8 k7 C
else
: q' P+ i$ R5 O( q6 K+ u  {  Wcross_marquee.style.left=marqueewidth+8
0 p3 O" C5 }* q, D( Z
# F! C9 x7 W% `: Q" a% Y}
9 b0 E' Q4 [8 Qelse if (document.layers){8 {) k. b& f. j* S/ u! D6 S
if (ns_marquee.left>(actualwidth*(-1)+8))
, m- {2 G  j! K- j3 @9 v9 n+ [; s- Ins_marquee.left-=copyspeed) u3 a5 H6 Y* v* R' t
else6 E. W! a+ L" Q
ns_marquee.left=marqueewidth+8& j8 h4 H. \4 h& b2 F% U$ \6 B
}) T, A) u- f( Y/ j' o/ X
}- [) z; ~# e1 \: _
7 i7 N) K4 V0 y$ _
if (iedom||document.layers){
$ {# a. L" C% [; Vwith (document){( P: R( X4 d# Q- A3 V4 r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): a- l& H- h& c  @4 ~
if (iedom){) K1 k) ]: a" F) h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& n3 V+ Y8 U+ V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); f7 r$ G% _5 N- e5 f7 j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: d& l' h1 q8 @write('</div>')8 W2 ?& ?5 A6 C
}9 }7 a" S( p/ E2 N( m
else if (document.layers){  _5 Z8 V% o' o% a+ l6 d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( S8 ~2 x1 e) w2 ^! J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 b, }, f. F$ d, i
write('</ilayer>')8 h) X* j5 ?. p. e
}  p4 Y3 P9 s4 U- g% S
document.write('</td></table>'); p7 }  S8 H2 l9 m# q
}
4 R7 R: E$ |2 a# i0 P}
  L) C: ?. i* O4 t) ]0 A3 X  U</script>

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