符合3w标准的网页漂浮广告代码

来源:互联网 发布:淘宝修真记全本阅读 编辑:程序博客网 时间:2024/05/01 05:41
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head>   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />   <title>带关闭按钮的网页漂浮广告代码</title>  </head>  <body>   <div id="img" style="position: absolute;z-index:1000; left: 311; top: 815;visibility :hidden;" onmouseover="clearInterval(interval)" onmouseout="interval = setInterval('changePos()', delay)" align="right">    <a href="#" target="_blank"><img border="0" src="http://" /></a>   <br />   <span style="CURSOR:hand;color:red;font-weight:bold" onclick="clearInterval(interval);img.style.visibility = 'hidden'">X</span>   </div>   <script language="javascript">var xPos = 20;var yPos = document.documentElement.clientHeight;var step = 1;var delay = 30;                     var height = 0;                     var Hoffset = 0;                    var Woffset = 0;                     var yon = 0;                    var xon = 0;                     var pause = true;                    var interval;                    img.style.top = yPos;                    function changePos() {                   width = document.documentElement.clientWidth;                    height = document.documentElement.clientHeight;                    Hoffset = img.offsetHeight;                    Woffset = img.offsetWidth;                   img.style.left = xPos + document.documentElement.scrollLeft+"px";                    img.style.top = yPos + document.documentElement.scrollTop+"px";                    if (yon) {                  yPos = yPos + step;                    }               else {             yPos = yPos - step;                    }            if (yPos < 0) {                  yon = 1;                    yPos = 0;                    }                  if (yPos >= (height - Hoffset)) {                    yon = 0;                    yPos = (height - Hoffset);                     }                  if (xon) {                    xPos = xPos + step;                    }                 else {                 xPos = xPos - step;                   }                  if (xPos < 0) {                    xon = 1;                   xPos = 0;                   }         if (xPos >= (width - Woffset)) {                    xon = 0;           xPos = (width - Woffset);                    }                    }function start() {                    img.style.visibility = "visible";                  interval = setInterval('changePos()', delay);                    }              start();  </script>   </body></html>

0 0
原创粉丝点击