房天下 > 房天下问答 > 业主生活 > 其他
  • 漂浮广告,当鼠标放到上面的时候,希望停止漂浮

    漂浮广告,当鼠标放到上面的时候,希望停止漂浮<div id="img" style="position:absolute;; width: 200; height: 151">广告内容</div> <script LANGUAGE="JavaScript"> var xPos = 20; var yPos = 10; img.style.left= xPos; img.style.top = yPos; var step = 1; var delay = 30; var width,height,Hoffset,Woffset; var y = 1; var x = 1; var interval; img.visibility = "visible"; function changePos() { width = document.body.clientWidth; height = document.body.clientHeight; Hoffset = img.offsetHeight; Woffset = img.offsetWidth; if (y) { yPos = yPos + step; } else { yPos = yPos - step; } if (yPos < 0) { y = 1; yPos = 0; } if (yPos >= (height - Hoffset)) { y = 0; yPos = (height - Hoffset); } if (x) { xPos = xPos + step; } else { xPos = xPos - step; } if (xPos < 0) { x = 1; xPos = 0; } if (xPos >= (width - Woffset)) { x = 0; xPos = (width - Woffset); } img.style.left = xPos + docu

    提问者:武幻时空

    发布于2010-12-18

共1个回答
  • whanwff 丨Lv 0
    给div加上mouseover和mouseout事件就行了。<div id="img" onmouseover="pause_resume()" onmouseout="start()" style="position:absolute;; width: 200; height: 151">广告内容</div>
    +1 2010-12-19 举报
热门人气推荐
免责声明:问答内容均来源于互联网用户,房天下对其内容不负责任,如有版权或其他问题可以联系房天下进行删除。