<div id="ad" style="position:absolute">
<a href="http://www.cnblog.com/wayne173" target="_blank">
<img src="http://static.cnblogs.com/images/adminlogo.gif" border="0">
</a></div>
<script type="text/javascript">
var x = 50,y = 60;
var xin = true, yin = true;
var step = 1;
var delay = 10;
var obj=document.getElementById("ad");
function floatAD() {
var L=T=0;
var R= document.body.clientWidth-obj.offsetWidth;
var B = document.body.clientHeight-obj.offsetHeight;
obj.style.left = x + document.body.scrollLeft + "px";
obj.style.top = y + document.body.scrollTop + "px";
x = x + step*(xin?1:-1);
if (x < L) { xin = true; x = L;}
if (x > R){ xin = false; x = R;}
y = y + step*(yin?1:-1);
if (y < T) { yin = true; y = T; }
if (y > B) { yin = false; y = B; }
}
var itl= setInterval(floatAD, delay);
obj.onmouseover=function(){clearInterval(itl);}
obj.onmouseout=function(){itl=setInterval(floatAD, delay);}
</script>
<SCRIPT LANGUAGE="JavaScript">
var s = "网页可见区域宽 :"+ document.body.clientWidth;
s += "
网页可见区域高:"+ document.body.clientHeight;
s += "
网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)";
s += "
网页正文全文宽:"+ document.body.scrollWidth;
s += "
网页正文全文高:"+ document.body.scrollHeight;
s += "
网页被卷去的高:"+ document.body.scrollTop;
s += "
网页被卷去的左:"+ document.body.scrollLeft;
s += "
网页正文部分上:"+ window.screenTop;
s += "
网页正文部分左:"+ window.screenLeft;
s += "
屏幕分辨率的高:"+ window.screen.height;
s += "
屏幕分辨率的宽:"+ window.screen.width;
s += "
屏幕可用工作区高度:"+ window.screen.availHeight;
s += "
屏幕可用工作区宽度:"+ window.screen.availWidth;
document.write(s);
</script>
http://www.cnblog.com/wayne173 //换成是漂浮图片点击后出现的页面,也就是点击后出现的详细的介绍页面
http://static.cnblogs.com/images/adminlogo.gif //换成是漂浮广告图片的URL地址,最好采用绝对路径
var x = 50,y = 60 //浮动层的初始位置,分别对应层的初始X坐标和Y坐标
var xin = true, yin = true //判断层的X坐标和Y坐标是否在在控制范围之内,xin为真是层向右移动,否则向左;yin为真是层向下移动,否则向上
var step = 1 //层移动的步长,值越大移动速度越快
var delay = 10 //层移动的时间间隔,单位为毫秒,值越小移动速度越快