返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. f" R1 p  X! q( v( |var marqueewidth=300( Q, f- o2 b5 n8 Z1 g; s
//高度8 V( ~( X4 k: p6 {7 [2 @
var marqueeheight=25
9 F3 ?& \1 E$ o4 |( b//速度(1-10): v$ f  ^+ W( q) t0 B* E3 e
var marqueespeed=3* W6 E2 f" j* i/ s' L. ]/ m
//背景颜色! i0 f( e9 ^- s! q
var marqueebgcolor="#FFFFFF"
: T1 d5 }" O) y; q- j( E% E//是否能暂停 (0=no. 1=yes)?7 L. ~0 I& @6 j. m9 \# Z
var pauseit=1
& _" j) {% Y4 `  \) i8 Z" ~6 @$ r5 z3 c7 a( L( @* }
//修改显示内容
8 \8 m* d' v0 u: `$ f- i( u$ ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 r9 s+ `6 S, \; P, S$ P
4 ?# B0 x! y: d

1 \; B* \9 w( z4 i////下面不需改变////////////0 z3 @# L4 x+ h1 J( x, ^( R

; x  m+ E3 N3 G1 @var copyspeed=marqueespeed
) D  [- X5 w+ ~: b6 R2 D1 R! uvar pausespeed=(pauseit==0)? copyspeed: 0
- X2 L5 E# n) H2 Y3 Tvar iedom=document.all||document.getElementById
& n9 h/ u. p  E! kif (iedom)
6 v5 I  G! Q  m  R& edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 @# F, n& e, O: tvar actualwidth=''; t( G3 E& K/ i/ v/ v+ a
var cross_marquee, ns_marquee' V( E& h$ q) [! L' R* o: q( f
: B' p1 l8 |4 s. ~( x6 C" |
function populate(){6 @+ w0 K5 O8 v$ d
if (iedom){
1 d3 m+ L" e/ Q+ W- _1 u0 M# rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* J$ s- ~$ |8 C" h9 @4 Z" y4 ~8 a& ~
cross_marquee.style.left=marqueewidth+8
( ]- B/ q/ N" z) r  n! [cross_marquee.innerHTML=marqueecontent. Y7 F1 L: K6 @3 k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 E. z% l1 I+ G" h$ `$ u8 T' M/ P
}% k6 z) f4 Y" T6 f2 c0 m! W
else if (document.layers){
: N3 j" P! C- q" u/ E8 p9 o, Ans_marquee=document.ns_marquee.document.ns_marquee20 a7 B: t  M7 F( \
ns_marquee.left=marqueewidth+8
6 O- z  B. H1 C! F, \ns_marquee.document.write(marqueecontent)  e" P4 U8 `7 o
ns_marquee.document.close()
& n# i5 t( y5 ?. zactualwidth=ns_marquee.document.width0 i3 @3 |1 `) u
}0 q& |' l; c# {( i
lefttime=setInterval("scrollmarquee()",20)7 b. K# \* `  A, r7 h# O2 e% }
}
3 U* k" l1 M5 `  fwindow.onload=populate: e2 v/ \  I1 ~# [( ]2 c; Y

+ r9 O9 t1 g# R0 s1 _2 cfunction scrollmarquee(){7 R/ u- z7 c& O
if (iedom){
7 {! q, b$ h4 V6 @. y1 sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 v/ ?1 s( V" l" r. z5 G0 l/ r: j: Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 H# S# G1 H; p
else! e  P( i% Y  _1 O9 |/ r
cross_marquee.style.left=marqueewidth+8
# I  Z4 {: v0 @* I4 f3 m( q& S0 I2 t" q/ J
}
+ j& q% y: s! W) d% ~else if (document.layers){8 r9 X  C! K3 e! j2 {& H% [
if (ns_marquee.left>(actualwidth*(-1)+8))
( n$ x$ s% Y9 |3 |6 j- J0 Bns_marquee.left-=copyspeed
( e* x- L8 J3 n, ]$ m  Welse3 R$ @+ p: X8 k! p, K5 _
ns_marquee.left=marqueewidth+8. H  t) _. r4 m7 T0 g1 U
}
( q& n3 {2 V3 s5 l. l8 m$ A; g5 l}
/ Y- ~4 B7 n' X% M2 Z' v8 b4 ~. F! y* L9 z; d. M9 L: ]
if (iedom||document.layers){5 t6 g' R$ A* [) \# Z( R
with (document){
1 t) p  T  {8 P0 l9 S  odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  z; l0 L$ U3 n8 J, V
if (iedom){
; A1 }4 T! W" u+ V6 X/ d/ swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 P" `. c: C8 h- R4 Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- f3 D# X$ J+ w' m
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; Y# B1 F+ a, \& x! W0 P8 P0 i, wwrite('</div>'); P. P5 E4 [9 |" ]) j8 F  J
}
- y* ?0 Y+ R. a6 P; J0 x2 [. Uelse if (document.layers){2 [  T  i; V) `
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- V1 j+ m$ j% O! o
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' P* I8 B# `  _  G! s( @1 J
write('</ilayer>'), u# [. x; W$ V, j
}" R" U. z# \7 E$ Z, s; \
document.write('</td></table>')
, z% W1 Y8 g2 Y' L}. f7 f8 u- M$ u, J8 F! n) c
}( c6 T$ |# N. E) m  C) L* t
</script>

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