可加在<body>中的任何处!
<div ID="floater" style="left: 180px; top: 117px" >
<a href="http://dypg.hncj.edu.cn" target="_blank" ><img SRC="images/jzsx.gif" alt="欢迎访问讲正气树新风网站" WIDTH="200" HEIGHT="100" border="0"></a>
</div>
<script>
var x = 50,y = 60
var xin = true, yin = true
var step = 1
var delay = 20
var obj=document.getElementById("floater")
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
obj.style.top = y + document.body.scrollTop
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.οnmοuseοver=function(){clearInterval(itl)}
obj.οnmοuseοut=function(){itl=setInterval("floatAD()", delay)}
</script>
"http://www.w3.org/TR/html4/loose.dtd" >
< html >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" >
< title > 漂浮图片 </ title >
< style type ="text/css" media ="screen" > ...
#floater {...}{
position: absolute;
left: 500;
top: 146;
width: 125;
visibility: visible;
z-index: 10;
}
-->
</ style >
</ head >
< body leftmargin ="0" topmargin ="0" marginwidth ="0" marginheight ="0" bgcolor ="#CCCCCC" >
< div align ="center" >
< table width ="900" height ="900" align ="center" bgcolor ="#FFFFFF" >
< tr >
< td width ="900" height ="900" >
</ td >
</ tr >
</ table >
</ div >
< div ID ="floater" style ="left: 180px; top: 117px" >
< a href ="http://dypg.hncj.edu.cn" target ="_blank" >< img SRC ="http://fm032.img.xiaonei.com/pic001/20070405/2200/L1843448GE.jpg" alt ="欢迎访问讲正气树新风网站" WIDTH ="200" HEIGHT ="100" border ="0" ></ a >
</ div >
< script > ...
var x = 50,y = 60
var xin = true, yin = true
var step = 1
var delay = 20
var obj=document.getElementById("floater")
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
obj.style.top = y + document.body.scrollTop
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 >
</ body >
</ html >