返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 c+ Z6 Q8 U5 z5 W
var marqueewidth=300
3 v( f# s9 {2 L) P! ]1 J//高度% k- t. @% n/ ?0 H
var marqueeheight=25- d2 G. [! ?# l) h
//速度(1-10)
5 v! V* x0 s8 O. |) D. \: Zvar marqueespeed=3* i: l& }! ]( q
//背景颜色
0 p1 a: P0 K+ J( Z0 R5 xvar marqueebgcolor="#FFFFFF"
+ y$ H/ K$ j; ?" A" E) X2 x$ M" x0 E//是否能暂停 (0=no. 1=yes)?) I3 e8 o0 m% {, z) y: d( b8 E
var pauseit=1
1 `  i0 X' D) N( O/ d4 u8 P; s6 ^; i4 d
//修改显示内容
' N5 z; b! O8 Q; \; o' ]! r, Z9 i$ G" tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  N& f9 E, x& w9 S
( C1 n4 m% |  u! B* G- }
3 k% b9 H& W  L9 \( \////下面不需改变////////////
( I4 x; C; _& R: ?( b6 B$ _5 Z
! L. ~- g# m, p' F6 @8 uvar copyspeed=marqueespeed0 V) I( k  J$ `) w' k2 b% f. ]# ]
var pausespeed=(pauseit==0)? copyspeed: 0, D0 ^  Z2 n! {8 ^! X$ j+ _
var iedom=document.all||document.getElementById
, x4 H! F! W6 K& V; s  l7 Vif (iedom)' F; \# Y  C$ u; X- ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( V8 T  x: u- V% `4 rvar actualwidth=''. E9 C7 [% c( t: V) U: w
var cross_marquee, ns_marquee
" F% p; o- h& Z0 o
/ O' s9 L6 u4 Pfunction populate(){8 P# p7 s) a" @# g1 \8 C+ f/ g
if (iedom){
! ^, ]. j: r3 Y- g1 H& h! S: Wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  U# x9 ?5 I2 c
cross_marquee.style.left=marqueewidth+8
) z9 _# F8 U$ j6 }0 e1 lcross_marquee.innerHTML=marqueecontent3 n. H' `/ e1 |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 n" q7 }5 j# S" Q}4 ]& B0 U$ u- s* j
else if (document.layers){8 r' U5 A6 F5 |, h% v, n1 M
ns_marquee=document.ns_marquee.document.ns_marquee26 F( B9 |$ v  A0 Q; T# h5 D& S, H: B
ns_marquee.left=marqueewidth+8
( d  L4 t- y" `! ^ns_marquee.document.write(marqueecontent)
; P6 _4 ^! Q+ t- V9 m) E- nns_marquee.document.close()
# J! [4 v: C3 R5 `4 F" ractualwidth=ns_marquee.document.width' p8 h9 e' u1 l/ o- w% S+ j+ Z4 P, c
}/ h( P0 ]5 r7 o
lefttime=setInterval("scrollmarquee()",20)
3 J1 V6 ^3 k% R( e4 t+ \7 H5 P}
1 s9 n7 o* |. b5 y. swindow.onload=populate
8 D7 ^6 C0 e2 v' `5 \+ t
1 g7 S7 Y) k* H, G9 O) efunction scrollmarquee(){
' ]7 p+ e6 I% fif (iedom){7 o6 M, m0 t. ?' d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  Z7 t1 Z& b' u# H7 J9 R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 k9 D" S" T( j
else6 o3 a3 r6 t/ I2 _& W
cross_marquee.style.left=marqueewidth+8
% e! f6 S% g0 H+ ~! A/ ?  Y2 n: Y7 n
}8 V( M  h0 }3 R3 w! f2 m7 L0 I* `
else if (document.layers){' v" E, u+ T* L  v- l/ N
if (ns_marquee.left>(actualwidth*(-1)+8))" p( A5 O* p( n: c' ^( S' I& i
ns_marquee.left-=copyspeed
( P2 A2 B$ u. d; velse
  `( L5 A& J0 z. v& B0 Lns_marquee.left=marqueewidth+8! A3 ]7 v! Y' e! m! \$ H4 J
}
& v- a; J2 j! M* L8 N+ c1 M}
! i2 F+ }. K* J" G7 x+ e
. }' V1 Q5 Q! c( |& a% g0 Hif (iedom||document.layers){" d# ~, J+ h2 r% Q) i0 {2 M2 A
with (document){% b% U+ I) ]0 E  M) _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 \) J; Q) R! D# P# I
if (iedom){; t" y, w) g, [7 Y2 c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( P1 Q# V% {, S7 Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- V" U8 u4 E2 y& y( {) A  H- R/ {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! x" ]$ R: O) W0 ^4 v
write('</div>')
" \  R2 @: F/ I}! u, K/ u6 E' a
else if (document.layers){
: o- O$ z; |' ?4 f% [) e! N, `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) E+ |& f" O) Z" q. V" {0 r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& K9 y8 Y3 }. l  @# D$ N1 U* C$ \
write('</ilayer>'); ~% U& i' z2 h$ N$ i1 ?5 \8 Q2 f
}( j  T" g) W: e, j+ X. H; p  Q
document.write('</td></table>')
, o) h) u) r$ R4 m& Z! ?}
/ r2 D6 S1 N* z3 V" D' o}4 c8 D+ V' S3 k8 b) X
</script>

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