<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input id="found" type="button" value="新建">
<span id="aa"></span>
</body>
<script type="text/javascript"src="jquery-2.1.3.min.js"></script>
<script type="text/javascript">
t=true;
$("#found").click(function(){
$("body").append("<div style='width: 200px;height: 200px;background-color:#ccc;position: absolute;' id='run'>按住我移动</div>")
$(this).mouseup(function(){
t=false;
})
$("#run").mousedown (function(e){
$(this).mousemove(function(e){
if(t)
{
$("#aa").html(e.pageX+","+ e.pageY)
$(this).css({"left":e.pageX+5+"px","top":e.pageY+5+"px"})
}
})
})
})
</script>
</html>
你的代码中有以下几处问题:
t=true;根据你的要求,我写了一段代码,你可以参考一下:
$("#found").click(function(){已经做好了 谢谢
追答不用谢