获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; @0 M5 i- c- K& P5 wvar marqueewidth=300
% }+ p- t$ @0 ^# i3 ]# i% R//高度
. f1 b$ r. V# N! Gvar marqueeheight=25
( F! O$ N2 |$ s5 N//速度(1-10)
9 G' u4 \3 x# N5 B6 y% Nvar marqueespeed=3
8 A- C: N' z4 @  Q//背景颜色/ J7 c! L( d5 R
var marqueebgcolor="#FFFFFF"
9 ?: B  h& @3 E1 q! L$ |, {3 j9 G. u//是否能暂停 (0=no. 1=yes)?
7 N- Q5 T0 W5 vvar pauseit=19 u" o, K5 J  e3 L$ l$ Y9 _

# _, l. T+ p6 n) p, q2 F% a//修改显示内容
2 E+ g% m" t5 c, j! Q  yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') v2 _/ Q1 G  u% A) g3 Z9 @
% S( [0 {9 h6 [# ^
2 W5 ]8 p/ T6 Y. ~) C3 |
////下面不需改变////////////
0 z; ^2 D& j5 m/ m& w+ R
3 H4 `4 ]/ V$ X" g) S6 Pvar copyspeed=marqueespeed8 }7 G, V" v. M' ]3 C' S
var pausespeed=(pauseit==0)? copyspeed: 0
) H6 `: \0 V, |var iedom=document.all||document.getElementById% K2 b& v* m. T
if (iedom)/ A% B" Y/ x$ L# V) N6 I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 Z# @* J% H* j! x, \4 Avar actualwidth=''
  m1 y6 ^( }7 D0 A7 @8 g5 Qvar cross_marquee, ns_marquee  }3 @9 w! S8 e9 a0 F

) J. C) t0 k# Y7 @: }2 ufunction populate(){! T# O4 @1 D2 E; Q+ x0 N
if (iedom){+ m& |/ d- ?5 X" j( m5 j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ k$ c$ a6 m2 r( m3 a
cross_marquee.style.left=marqueewidth+8
/ O. N* Z6 ^# H# V: ]cross_marquee.innerHTML=marqueecontent- _7 {( Z) G" T4 b) v' K1 t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ C/ V+ D9 C0 U9 O! Y}
+ P  _: H  W) g& ]3 celse if (document.layers){
! m5 \: \# ^4 ons_marquee=document.ns_marquee.document.ns_marquee23 p( }: h' ~2 J! ]
ns_marquee.left=marqueewidth+8; O; S" s$ z, l: ]0 a' Y
ns_marquee.document.write(marqueecontent)7 z- Z( ~6 e* T0 p+ w
ns_marquee.document.close()0 a- R) ~/ [# X( s& }
actualwidth=ns_marquee.document.width
2 f1 [" d: U+ J5 Q0 h9 ^}3 G' s7 o9 {5 c  A2 O7 R
lefttime=setInterval("scrollmarquee()",20)
7 V8 N! \# E; m5 x5 e7 Y! b}
( V0 q7 p, t. F7 G. K4 Cwindow.onload=populate! s- [* }, W) T+ P

7 j, m1 [- ~7 Gfunction scrollmarquee(){
0 X$ l  K  E8 S2 d; }6 pif (iedom){+ Y3 b/ P) v  L7 B, `% E( _+ K& R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 L" e; _& \. B# a: Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 c6 ?5 o' t$ i1 b: e+ z  i
else  O, T" Y" K: h$ ]# U
cross_marquee.style.left=marqueewidth+8
# x6 S5 h1 z2 w2 k2 m& A8 [
7 ^: l* X' @+ y& W}
% x5 C2 n  _4 u3 Y, X# z$ velse if (document.layers){
7 e/ o/ }0 T+ m4 J, Sif (ns_marquee.left>(actualwidth*(-1)+8))# R9 t- o0 s& A$ i) b
ns_marquee.left-=copyspeed4 M0 u8 z7 C3 {' J& n  d. v0 h+ S
else  S- b( v+ d* L) Q
ns_marquee.left=marqueewidth+84 J7 x9 d3 X% z# p5 l
}& M- V1 `& e& b$ `1 P
}. O& K' b; @; t7 v: l

$ a6 i1 q# m8 i+ w( n* Q  Rif (iedom||document.layers){) p% j; d& y, Q
with (document){* c+ L' c$ {( v7 m7 _6 |# j/ X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; E5 d0 [- O6 P# O- s% yif (iedom){
8 V4 F8 ]6 a" B2 _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" M! X! [( C1 A# f5 e- x+ C/ ^+ I/ Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 n' e, A" N+ k6 Z; o* n: \+ x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 Y4 g; ^7 Z' ]& Ewrite('</div>')0 z4 O( o1 |  |, e3 G8 W8 G
}
1 h6 R5 Z9 p  X# B3 K% {" Melse if (document.layers){! O" L3 K& o, h' b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ z( [( P7 R; t' v6 j4 E' O
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): I/ }4 T+ `( }* T. `1 \' v$ K: ]
write('</ilayer>'), a0 P! p! B$ [; n; e/ N5 j
}8 y7 P  ?6 |4 M  i1 C
document.write('</td></table>')4 t% b) B5 a/ Z
}
7 q+ c8 q$ B: u0 U& X& a9 g' P}2 f) B- m+ A! ^( Z& \+ T( s9 I
</script>

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