找不出错哪,眼瞎了也找不出,,,旁观者清,求教
这里是我运行了的正确的代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>挑战题</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<style type="text/css">
div{
width:100px;
height:100px;
background:red;
position:absolute;
margin:50px;
}
</style>
</head>
<body>
<div></div>
<input id="left" type="button" value="左移"/>
<input id="right" type="button" value="右移"/>
<script type="text/javascript">
$(function(){
$("#left").bind("click",function(){
$("div").animate({
left: "-=50px"
},3000)
});
$("#right").bind("click",function(){
$("div").animate({
left: "+=50px"
},3000)
});
});
</script>
</body>
</html>