熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Javascript >> 正文

詳細解析網頁漂浮廣告代碼的含義

2013-11-23 17:58:29  來源: Javascript 

  網頁漂浮廣圖片特效這種特效我們總是很喜歡鼠標指向圖片後圖片停止移動

  <pre>
<div id=ad ><a >
<img src=/img/jpg border=></a>
</div>
<script>
  var x = y =
  var xin = true yin = true
  var step =
  var delay =
  var obj=documentgetElementById(ad)
  function floatAD() {
     var L=T=
     var R= documentbodyclientWidthobjoffsetWidth
     var B = documentbodyclientHeightobjoffsetHeight
     objstyleleft = x + documentbodyscrollLeft
     objstyletop = y + documentbodyscrollTop
     x = x + step*(xin?:
     if (x < L) { xin = true; x = L}
     if (x > R){ xin = false; x = R}
     y = y + step*(yin?:)
     if (y < T) { yin = true; y = T }
     if (y > B) { yin = false; y = B }
  }
  var itl= setInterval(floatAD() delay)
 objonmouseover=function(){clearInterval(itl)}
 objonmouseout=function(){itl=setInterval(floatAD() delay)}
</script>
</pre>


From:http://tw.wingwit.com/Article/program/Java/Javascript/201311/25462.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.