效果:图片在页面上随机移动。
遗留问题:性能不是特别稳定,怀疑和浏览器有关,谷歌浏览器效果差。
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
#divID{
position: absolute;
}
</style>
</head>
<body οnlοad="run()">
<div id="divID">
<a href="http://user.qzone.qq.com/710273686?ptlang=2052"><img alt="" src="zhu.jpg" height="200" width="112"></a>
</div>
</body>
<script type="text/javascript">
//加载事件
function run()
{
document.getElementById("divID").style.top=Math.random()*400+"px";
document.getElementById("divID").style.left=Math.random()*300+"px";
window.setInterval("run()", 1000);
}
</script>
</html>