<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<title>浮动广告</title>
<style type="text/css">
div{
position:absolute;
left:20px;
top:20px;
}
</style>
<script type="text/javascript">
var floatDiv = function () {
//找到div,控制左上角的位置left,top
document.getElementById("div1").style.left=Math.random()*500+"px";
document.getElementById("div1").style.top=Math.random()*500+"px";
setTimeout("floatDiv()",1000);
}
window.onload=floatDiv;
</script>
</head>
<body>
<img src="1.jpg"/>
<div id="div1">
<img src="2.jpg">
</div>
<!--
<script type="text/javascript">
floatDiv();
</script>
-->
</body>
</html>