全屏浮动js
查看效果: http://www.leyikao.com
源代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>安博中程乐易考</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
</head>
<body>
<div id="img" style="LEFT:20px; visibility:hidden;POSITION:absolute;
TOP:20px;z-index:10000;"><a href="http://www.leyikao.com/t/beida/"
target="_blank"><img
src="http://www.leyikao.com/templets/default/Images/logobeida.jpg"
width="127" height="46" border="0"
style="cursor:pointer;"/></a></div>
<script language="javascript">
<!-- Begin
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;
var img = document.getElementById("img");
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.body.scrollLeft+"px";
img.style.top=yPos+document.body.scrollTop+"px";
yPos = yPos + step*(yon?1:-1)
if(yPos<0) { yon=1; yPos=0; }
if(yPos>=(height-Hoffset)) { yon=0; yPos=(height-Hoffset); }
xPos = xPos + step*(xon?1:-1)
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);
img.onmouseover=function(){clearInterval(interval)}
img.onmouseout=function(){interval=setInterval("changePos()", delay)}
}
start();
// End -->
</script>
</body>
</html>
查看效果: http://www.leyikao.com