给大家推荐个靠谱的公众号程序员探索之路,大家一起加油
<!DOCTYPE html>
<html>
<head>
<title>跳动</title>
<script type="text/javascript">
function fun() {
document.getElementById("pf").style.top = Math.random() * 500;
document.getElementById("pf").style.left = Math.random() * 500;
setTimeout("fun();", 1000);
}
</script>
<style>
#pf {
position: absolute;
left: 20px;
top: 30px;
}
</style>
</head>
<body onload="fun();">
<div id="pf">
<img src="piaofu.jpg" />
</div>
</body>
</html>
注意:只能在 IE中实现 现在 大部分浏览器 不兼容