返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 A) x# d! u2 b, m$ X1 N
var marqueewidth=300; P: H# }( |3 h& k4 Z# [2 L
//高度
4 ]& ^/ a9 v9 e. dvar marqueeheight=259 ?3 x3 {" x5 Z0 }+ y7 c: q. ~
//速度(1-10)
: m- W. s* ^9 w; [) @0 P/ Wvar marqueespeed=3
/ C9 O+ k: H% j, j8 {//背景颜色
0 b, @+ O; L% lvar marqueebgcolor="#FFFFFF"
7 F* w5 s3 t# p9 u% f//是否能暂停 (0=no. 1=yes)?
3 T7 }% @( L4 ^. b+ ^- }: r# uvar pauseit=1
' m! g& g8 X: P" C, j% \
' E6 L" }1 @  O4 O//修改显示内容
' x3 S. {% [9 L; ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ u. v: c0 o& v: J# n' ~+ `

; i& @" Y6 |# f* P- i% b" x
4 L5 {" o( g8 ~4 k$ z////下面不需改变////////////5 S& M! {6 v+ I" C; ?5 g$ z4 W

$ X& |5 X8 I( jvar copyspeed=marqueespeed
5 I8 y8 R; g- O& mvar pausespeed=(pauseit==0)? copyspeed: 0
0 u3 h; p( o5 Ivar iedom=document.all||document.getElementById* ?# E$ m6 x3 A) O6 w
if (iedom)
' z2 g& a. N/ a; \4 N/ x- fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 ?& n+ {& y7 _; \5 x
var actualwidth=''
3 r' k# G  |. T4 [var cross_marquee, ns_marquee7 C! q: r6 {$ I0 M2 ?- a% U
; c! v+ j0 r/ e
function populate(){
  [: p: `0 T3 t: P: W9 {+ xif (iedom){3 p  i, G8 [5 Y, P8 \8 [* J! d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. a' e7 d* Q* G7 @$ c! |+ Z5 O& u
cross_marquee.style.left=marqueewidth+8
( Y" S3 ^- f/ _6 R4 r, `cross_marquee.innerHTML=marqueecontent
; K; r4 k2 U) @9 w+ ~# h5 z! t0 E% h- Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 @: C) W( r% m3 F+ t' b, G0 \}
' e1 ~8 A& `% R2 s% welse if (document.layers){# c. D" l" B/ q, {$ ]+ V1 K  f8 b7 J
ns_marquee=document.ns_marquee.document.ns_marquee29 Q  q$ y4 |  ~- }
ns_marquee.left=marqueewidth+8
7 L. M5 n% q- I3 t- }: ]/ i1 K8 c1 rns_marquee.document.write(marqueecontent)' r5 e7 ?  P* n8 h. K% Q- D; M
ns_marquee.document.close()/ n8 Q$ A! a4 Y! H0 x' s+ W4 {$ k( x% o
actualwidth=ns_marquee.document.width, b# U+ Q! U- W- j( M" R  K% _: B
}
* N. f& p# s0 R4 u1 olefttime=setInterval("scrollmarquee()",20): b: l9 A6 F9 E/ v4 C5 v# I
}8 w4 G- Q  e# c0 ]
window.onload=populate
' x8 `( Y% n& I. N/ o3 |) U  }' n! l* H
function scrollmarquee(){# N9 u* J" N6 E! o
if (iedom){
( {. G: q9 W1 ]( _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- u4 E. m" }5 O, e6 ?' O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" {/ N. Y! f: w7 _6 P6 n- Velse$ [9 r( ^9 ?0 L& O. i- j
cross_marquee.style.left=marqueewidth+8
$ L  B( I& i- {6 _. M9 A8 ?4 X$ d1 O( ~9 l- v; w
}+ X( n4 ^( U& c# H8 r% C
else if (document.layers){3 {4 O4 I9 }0 H( m9 h* E2 r
if (ns_marquee.left>(actualwidth*(-1)+8))8 M& L! J8 t5 ?8 h# E/ B
ns_marquee.left-=copyspeed
' B- n0 ?$ q$ r+ p3 S9 |else
# O5 Z: }7 c1 J' E/ p$ Yns_marquee.left=marqueewidth+8
- ^8 A. v; d- K3 L}& d$ y$ T) b' y; h& m
}9 C4 N4 a3 f# G8 A) k5 @/ j
: s5 H6 m1 Q7 D# b
if (iedom||document.layers){
2 Y7 z. }; V& L- a, Xwith (document){& T. r; t* }. O6 J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), H1 |3 K6 F  q4 L) F
if (iedom){
7 d4 C# ]0 x! u, W% X% k- Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& v' J5 Z: A' t: c# J7 f+ Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  x% X# a+ @2 U$ m) r( E$ I
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 w, Z" {) s) n# T# T& F- ~/ s  s  Vwrite('</div>')
" E$ M) O) N1 E- @8 \' p  ~}( l  u7 x. L/ @" k8 y* D
else if (document.layers){
3 F, {4 L6 B4 D8 Q/ l5 @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( F$ j0 W+ L4 A) j; C: N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* p- C+ J* o6 w- {
write('</ilayer>')5 O' ]" I9 V! @, O% G, P- r
}3 k" I, C6 D1 k
document.write('</td></table>')
' g$ f( |; A. ?% c9 C}
2 q! U# |: \  r, J}' _. L' p$ Q0 y9 b9 f9 Y
</script>

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