返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 B$ M. w- i) E4 X# V
var marqueewidth=3001 V: T) N( P$ y0 J
//高度% z* v& u( A2 Z0 O3 r! V2 i
var marqueeheight=258 C& R8 k, s' b8 U5 j! V( O
//速度(1-10)% L/ K& c4 h. {* N
var marqueespeed=3( q) a0 T) R; C' @
//背景颜色
2 F- k) e- s: ?& M! |var marqueebgcolor="#FFFFFF"
: Z- }1 f9 o1 ~: P) K//是否能暂停 (0=no. 1=yes)?) ~% ^' ~+ B8 z3 g0 ~. h7 T
var pauseit=1
3 D# [+ E6 w* P- s; r6 ?% ]1 M5 x
//修改显示内容& L) g+ a3 ]$ h" L) w( T3 {; N0 w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 v: k+ ?' W7 A

5 _9 H( y$ a' w5 h" z
, X& c; e! V% m- g* ~////下面不需改变////////////3 @9 R+ p" p% U; I3 Z( P
9 f5 R* z+ W  z' Y
var copyspeed=marqueespeed/ v8 C4 ?( o! j
var pausespeed=(pauseit==0)? copyspeed: 0) j' L) N4 r7 G" M  x7 d9 `3 Z7 T
var iedom=document.all||document.getElementById" |! @" W" w$ w5 Q% n# p
if (iedom)
2 Z& r/ h! y/ _7 f2 G1 wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 q5 R& f6 V  evar actualwidth=''
/ i$ m. n% T, l( f( H2 G" t" V0 L/ C. Wvar cross_marquee, ns_marquee
# {% H8 B2 u# A. E8 A
% a2 t, F# t: k* ofunction populate(){! c1 V! b9 ^- u7 [9 D* o7 S
if (iedom){9 |8 l0 U0 l- W, ^% Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! j4 q+ J/ k( B  lcross_marquee.style.left=marqueewidth+80 J( U3 W( O- {" `" j
cross_marquee.innerHTML=marqueecontent
3 s- h& a) G" d: I" Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 N8 d; S' p6 s}2 s( M; S6 b, @% l' I' U+ V: m
else if (document.layers){. l" _' V' {" j
ns_marquee=document.ns_marquee.document.ns_marquee28 ^- x- L& U/ B' W! {: y
ns_marquee.left=marqueewidth+8. P( ?/ m) n) ]& \
ns_marquee.document.write(marqueecontent)
4 Y2 e8 J7 W) d7 m6 ~2 i$ Wns_marquee.document.close(): ~; l' c* v4 _5 W
actualwidth=ns_marquee.document.width9 V* m4 @  l) M3 k" r) T3 M
}* s% p. P) g. G& p2 [9 w
lefttime=setInterval("scrollmarquee()",20)
$ x& B* a% e; h/ u1 @}
- c" P$ \. r* ?window.onload=populate
8 h/ M& Q% s; N; E2 [$ N1 i( ^  T1 E$ g- a$ l) b% W
function scrollmarquee(){: D; d$ |( @8 t6 S! T9 N& X9 u: q& }" t
if (iedom){
" A) O1 |3 b( y& v" n1 _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  ]8 X2 p" L9 y$ }# y4 g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 ?# ]. b+ R4 c; t0 |$ o3 g# f
else
/ f- V! `- [# R' [cross_marquee.style.left=marqueewidth+8
! ~* F8 H# h7 E3 B! y: e+ ^! G2 _4 I9 q: _
}
0 f+ _$ p% c) Xelse if (document.layers){
3 n+ E1 C/ N/ A% cif (ns_marquee.left>(actualwidth*(-1)+8))' [$ S* P4 m- Z" I4 \' I9 Q" n9 B
ns_marquee.left-=copyspeed
! ?( }! q( o  D! V8 R9 e' lelse* Y* i. g. i8 j6 c! C' ]
ns_marquee.left=marqueewidth+8
; J$ l/ G/ S3 c' c# p) p}' J1 a- W* ]" ]4 p
}
! y  L0 g0 a+ s( V7 V& [
: ]* ]) m8 c; w/ Fif (iedom||document.layers){
1 A% H5 x: M2 K5 t6 Ewith (document){
3 z/ ]# X; A* P3 bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 v) j* Q$ {$ V' B, |2 X" Q
if (iedom){$ |( u+ o# w' C& N) ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 T+ c& P5 i  Rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 i4 w7 k# Q) W2 [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& Y6 v/ D$ `' f% U5 f
write('</div>')
, h2 P5 j- P  g( N6 s0 k}6 p8 D' ?: c' N0 n$ l0 u. g; K
else if (document.layers){
  {& [7 s) @8 vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 q8 ]. t. e  g# Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 ^4 G& D0 V' p. [9 F  ~  M
write('</ilayer>')
: c% l8 J6 x& e( z! S}
4 J" L( K& O4 t4 Xdocument.write('</td></table>'); J' ?, L: v7 g# V$ v
}
0 a7 k& w6 _4 w8 M0 E* j}# L- n+ w& M# [8 _: x5 F( ^
</script>

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