网页小游戏

作者在 2015-03-22 20:54:26 发布以下内容

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>点我啊</title>
<style type="text/css">
 img{
  position:absolute;
  top:10px;
  left:10px;
 }
</style>

<script type="text/javascript">
 function mouseover(img){
  var x = parseInt(Math.random() * screen.width);
  var y = parseInt(Math.random() * screen.height);
  img.style.position="absolute"
  img.style.marginLeft = x + "px";
  img.style.marginTop = y + "px";
  
 }
</script>
</head>

<body>

<i--  360浏览器不用 images文件夹,直接选择同html文件夹里的图片。src="cat.jpg" -->
 <img src="images/cat.jpg" width="37" height="49" onmousemove="mouseover(this)" />
</body>
</html>

学习档案 | 阅读 2112 次
文章评论,共0条
游客请输入验证码
浏览239603次
最新评论