这段代码有问题么?
明明在普通html页面运行很好的代码,但是到了一个css+div的jsp页面。
浮动div也不跟随滚动栏了,并且向右向下漂浮时出界。<html>
<head>
<title>js test</title>
</head>
<body>
<DIV id=img1 name=img1 style="Z-INDEX: 100; LEFT: 2px; WIDTH: 59px; POSITION: absolute; TOP: 43px; HEIGHT: 61px; visibility: visible;"><embed src="http://img1.126.net/channel5/006557/yd200120_091117.swf" width="210" height="84" wmode="transparent"></embed><a href="#" onClick="noshow(1)">x</a>
</DIV>
<script language="javascript" type="text/javascript">
var xPos = 300;
var yPos = 200; 
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;
img1.style.top = yPos;
function changePos() 
{
width =  document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img1.offsetHeight;
Woffset = img1.offsetWidth;
img1.style.left = xPos +  document.body.scrollLeft;
img1.style.top = yPos +  document.body.scrollTop;
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()
 {
  img1.visibility = "visible";
interval = setInterval('changePos()', delay);
}
function pause_resume() 
{
if(pause) 
{
clearInterval(interval);
pause = false;}
else 
{
interval = setInterval('changePos()',delay);
pause = true; 
}
}
start();
function noshow(n){
document.getElementById('img'+n).style.display="none";
}
</script><!--<SCRIPT src="js/zyz.js"></SCRIPT>!-->
 <table width="778" height="1500" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="f4f4f4">
  <tr>
    <td>&nbsp; </td>
  </tr>
</table></body>
</html>