跟着鼠标飞的图片

<!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>
<title></title>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$(document).mousemove(function (e) {
//document指整个文档position:absolute不能少
$("#div1").css("left", e.pageX).css("top", e.pageY);
});
})
</script>
</head>
<body>
<div id="div1"style="position:absolute"><img width="200" height="200" src="1.jpg" /></div>
</body>
</html>

 

posted @ 2012-02-24 14:06  zwjyx_  阅读(179)  评论(0编辑  收藏  举报