返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ B7 }( N& @( l9 Ivar marqueewidth=300
3 ~% @  n, \7 H* \3 i//高度& x8 Y; Q8 d% b
var marqueeheight=25
) e' @' u# Z# M- Z6 u- ~% V//速度(1-10)
5 K+ Z1 w- M) m2 v) W$ Z2 ?var marqueespeed=3- X5 V% }3 y1 `7 G9 S# z
//背景颜色% U1 N8 G( X5 s
var marqueebgcolor="#FFFFFF"% i6 N! J2 a# {2 J, W2 K
//是否能暂停 (0=no. 1=yes)?
) Q. F$ M- ?# ?var pauseit=1
2 Q- a! p: Q# m- n; l0 G6 \3 l2 t. q) a7 U
//修改显示内容7 t+ A* A9 y1 G" q. z6 B. D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& ^) X$ B$ N* H2 `
; g  |5 T5 s! q

9 ~, l, q* f9 _8 l  C////下面不需改变////////////1 d1 e6 C. x' n3 O# w
" y! s2 S  N1 e8 y
var copyspeed=marqueespeed
2 E' T1 G  S  ~var pausespeed=(pauseit==0)? copyspeed: 0
9 N3 E% Y0 G% _- W! m' V  Vvar iedom=document.all||document.getElementById' O7 C6 k: `" J8 Z
if (iedom)
9 }6 H8 ^1 E3 p, r- R6 N+ Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ V5 E! x- |) x8 ~1 k  p
var actualwidth=''7 ^' U7 w" O7 U
var cross_marquee, ns_marquee
' G7 T* \3 t7 n1 o7 W. ]  a0 \, U( [
function populate(){# @1 B+ |2 u* f" O5 Q. h
if (iedom){
! t- `: t/ C4 E4 Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 `. e# s) X( U% F
cross_marquee.style.left=marqueewidth+8
5 V3 J: X% r% v$ ~* `/ M4 e' rcross_marquee.innerHTML=marqueecontent) ^- u! c, A6 a* p! s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( N: K, K, x' z. g; `, `4 r: l}
) p! p, @: ]' {( \else if (document.layers){+ v  {, [  J# \7 u( v
ns_marquee=document.ns_marquee.document.ns_marquee2
0 y9 e" W9 i, o* S: a7 {8 u. \, Vns_marquee.left=marqueewidth+8
4 w% _; H8 T1 g0 n, C0 q/ @ns_marquee.document.write(marqueecontent)
2 J) W+ d( ^+ m4 z6 E2 hns_marquee.document.close()
$ S# h8 |+ \. I6 z% o/ l; F; ]actualwidth=ns_marquee.document.width
# B" X0 ]4 O8 ^! G3 a( H) d; h}% I$ @8 p/ ]! _4 Z6 G
lefttime=setInterval("scrollmarquee()",20)
& w/ G, O* Y- k& y7 O+ z7 O}
, ]2 X3 M2 Z8 ^4 O8 Y* {window.onload=populate
9 s% U! C) T5 Z6 f
/ K; g, Z0 \+ g$ c5 w, [3 n# sfunction scrollmarquee(){4 @4 f) c8 m/ J  M8 T" ]
if (iedom){
& e6 F: M; @4 h3 \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 |/ a/ B; h# r8 t, ~7 E" Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: L0 j, |% Z, p8 `4 y% felse
$ ^7 c( A3 O0 ?) l# z" fcross_marquee.style.left=marqueewidth+8
; j, D# g; x; [5 K2 S4 U( k+ H$ m8 N
}
1 W$ V& E1 t/ R; b" _; yelse if (document.layers){
3 H" n, O( n9 B& hif (ns_marquee.left>(actualwidth*(-1)+8))
" P/ E, J) y7 z2 u. m; }* Sns_marquee.left-=copyspeed
/ I8 B8 u5 |& Q7 u) Zelse/ @! n) E' u9 `& m
ns_marquee.left=marqueewidth+8
  @3 }  X3 z0 G4 z}0 S- r2 Q) z$ {2 E0 [6 X! \
}
/ s; V0 o7 G; \* c
# J5 C8 S3 R& I! Y+ Mif (iedom||document.layers){$ b! X+ ?. n" v4 a' t4 D4 w
with (document){  ?! Q9 L$ x% \* G& e3 M* b7 P) A' f$ ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 X/ q& j1 v" W& Aif (iedom){4 j; b. O. r  d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# q% d1 `# D, W# T7 T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 p0 n0 t4 z# T: n5 ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 i/ ?$ U, b7 C! }' _/ W4 y- T
write('</div>')' G, J* a8 K8 ~! B$ n
}
, q$ T6 F4 d/ k3 d1 pelse if (document.layers){8 G: _! z# |- C* r# k# B" B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 [2 P4 t. D8 P& B% B; `/ o; Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  m. w3 D( W& _  t0 y1 Swrite('</ilayer>')
+ [% f3 V) t& K7 y}
; j" T' n$ Q$ C- Q: C$ Bdocument.write('</td></table>')
2 d( r) I$ T' [}- t# \% b, J4 O5 z
}
! o8 {7 F7 l2 E8 G6 \& n5 c</script>

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