zoukankan      html  css  js  c++  java
  • js漂浮代码支持w3c.

    <div id="img" style="position:absolute;; 200; height: 151"><a href="#" target="_blank"><img src="/templates/default/images/fd.gif" border="0"></a></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 + document.body.scrollLeft;
      img.style.top = yPos + document.body.scrollTop;
    }
    function start()
    {
      interval = setInterval('changePos()', delay);
    }
    function pause_resume()
    {
        clearInterval(interval);
    }
    start();
    </script>


     友情连接-广告之家,创意的家,好玩的广告 http://www.adggs.com

  • 相关阅读:
    racket eval
    mex不兼容
    【转】雷军 程序员随想
    UBoot 目录结构和编译过程
    远程监控web开发
    STL容器[08]
    STL容器[07]
    STL容器[17]
    STL容器[06]
    stl.map使用总结
  • 原文地址:https://www.cnblogs.com/binlunia/p/11267719.html
Copyright © 2011-2022 走看看