返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& s6 }" U$ H2 s' F4 ?var marqueewidth=300
5 J6 ?3 B' e  D$ Z//高度
* l% H' a) P& d& X/ lvar marqueeheight=25) B5 T* \, E6 h( d
//速度(1-10)
; U2 E! w5 L, H& d5 i3 j9 Fvar marqueespeed=3, k8 H3 r# G3 I: h, \0 P5 e
//背景颜色
* ?7 o2 G9 Y  v# |, ?; Xvar marqueebgcolor="#FFFFFF"; D- u' M3 f' b. X" ^* r0 B1 y( j: W
//是否能暂停 (0=no. 1=yes)?7 |# o7 N* D3 k
var pauseit=1+ ^' L# x( ?* c* B
: i# m$ B1 f5 V
//修改显示内容) |0 ~' \9 i" D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 v* |, o) |2 }5 W" H+ e% d

& P/ a3 I: z7 r1 W
7 b4 [% ?) C; F. N- j////下面不需改变////////////5 ]* }1 v. \3 T! U6 ^( o

; r/ Y+ Q) L9 q  ]var copyspeed=marqueespeed
$ G* B7 \4 y) f6 hvar pausespeed=(pauseit==0)? copyspeed: 05 x$ [1 C9 R/ b, T
var iedom=document.all||document.getElementById
$ }; ]4 n5 k" O! P7 |if (iedom)$ l: m5 @! F, J- H* z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 a( v' _9 o6 Zvar actualwidth=''+ `) @& p+ q8 ]2 n
var cross_marquee, ns_marquee% n. s4 V& t* ^% h: ?6 F* |
4 N5 f6 b! g& I# o; s  j
function populate(){  \, b. W) R) q  R) x
if (iedom){) \" R7 ^0 p# k% G7 b6 ?8 b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ y9 h, n7 P# I3 g8 Bcross_marquee.style.left=marqueewidth+84 y1 O5 f; H" T& G/ [! Z1 t7 V5 y
cross_marquee.innerHTML=marqueecontent
( @! a8 Q: ~8 a) a8 e. Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 N2 H/ B; s/ P4 _/ A, u
}% [: o3 V5 L; t5 j* e/ e
else if (document.layers){: U& W' M* H& ^
ns_marquee=document.ns_marquee.document.ns_marquee2
  e3 f" ?; i+ Q3 J' ins_marquee.left=marqueewidth+8: s+ e+ s9 q9 m* m  w/ M- K! c. q
ns_marquee.document.write(marqueecontent)) g" d% m& F9 J  e3 l; s4 b5 g
ns_marquee.document.close()' C* y/ B% V1 \6 S$ R( o
actualwidth=ns_marquee.document.width! @, j. T5 \' p- E4 E& k
}
3 U1 V" P! T' X7 f; z$ B4 p! e, |! V4 Llefttime=setInterval("scrollmarquee()",20)
4 X3 j! M' B/ z6 {8 R& D}
4 Y  F8 Q6 h: L! K5 m( twindow.onload=populate
  t7 o/ y" g) R
& w. C8 u  ]8 l' u" D/ u/ }function scrollmarquee(){4 w/ m. G0 m. u- K
if (iedom){2 |0 V6 w- e* a. i' `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; M8 N7 L% d. o! [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( |4 S! U/ H5 D8 Selse
2 n0 W" n$ h6 T  [% ?3 Ecross_marquee.style.left=marqueewidth+8+ d, B3 g3 x# D' F: u3 ?+ S, ^0 t

! U( Y7 B8 A& e) h4 p}: G4 w7 r7 }% a# I" k
else if (document.layers){
2 ], \% n/ |' V1 zif (ns_marquee.left>(actualwidth*(-1)+8)). ~7 X3 U% F, O/ s' x8 s( c
ns_marquee.left-=copyspeed$ n1 [/ ]4 a: L7 j5 q
else
% C: U1 z9 o/ R% e/ K( Z& ]8 Sns_marquee.left=marqueewidth+8
' Y# ^9 j& Y2 U' l  {' O8 n3 W7 B}
' o$ X1 t0 z$ V9 B. k7 y0 y) }1 L}( K( N, l. j$ T8 ^: Y' t0 B

, D* J' V0 @# x% Uif (iedom||document.layers){8 |# t; ^- f( n  |- _* N3 Y1 u2 b. H
with (document){& T5 A$ I4 ^- P$ ^, e6 Y# D$ {  l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- _, _1 D- V% c4 z/ K0 h
if (iedom){$ }- A1 A  m& `( u, y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" G, e" l7 Q: ^8 t" e2 u; Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- i- U0 B5 X- l) e" @5 k: m) b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( ]9 y* X* @( v  @8 w: P6 J* j" i
write('</div>')
; @  \- w  V' d/ U}3 v+ Y- m" o: F! j3 L, D
else if (document.layers){
) r) f6 Q% z/ K6 S2 L7 b) Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% N6 ^0 K) g) D' k+ S3 W+ r* s
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! `4 A: s" z5 ewrite('</ilayer>')
4 q' h6 N8 Q- i2 W}# p6 w1 A1 o0 @# u0 Y; P( j
document.write('</td></table>')+ E; R/ r; }7 I
}6 y. F( z, P6 d' z# a
}  C6 {. ]- z# D6 K( z4 g& o
</script>

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