初学js,做了一段代码,可是怎么也漂不起来,请各位大侠帮忙看看问题出在哪里.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
//随机漂浮的广告
function a(){
//设置广告漂浮的随机位置
document.getElementById("ad").style.top=Math.random()*1024;
document.getElementById("ad").style.left=Math.random()*768;
//每隔一秒重置广告的位置
window.setTimeout("a()",1000);
}
</script>
</head>
<body onload="a();">
<div id="ad" >
<a href="http://www.126.com">
<img src="./image/1.jpg" border="0" />
</a>
</div>
</body>
</html>