敢问为什么运行不了。
郁闷半天了。。
2015-03-10
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<style type="text/css">
#square{
width:200px;
height: 200px;
background-color: black;
margin-left: 400px;
position:absolute;
left:0;
top:0;
}
</style>
</head>
<body>
<div id="square"></div>
<input id="left" type="button" value="左移">
<input id="right" type="button" value="右移">
<script type="text/javascript">
$(function(){
$("#left").bind("click",function(){
//alert("l");
$("#square").animate({
left: "-=50px"
},1000);
});
$("#right").bind("click",function(){
$("#square").animate({
left: "+=50px"
},1000);
});
});
</script>
</body>
</html>
举报