请问这样写哪里有问题,非要用bind语句吗?
看不出哪里有问题
2015-02-12
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery动画特效</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<style>
div{
position:absolute;/*这一句很重要*/
background-color:green;
width:50px;
height:20px;
}
</style>
</head>
<body>
<button id="a" onclick="x()">左移</button>
<button id="b" onclick="y()">右移</button>
<div></div>
<script type="text/javascript">
function x(){
$("div").animate({left:"-=50px"},2000); /*向左移是减去*/ }
function y(){
$("div").animate({right:"+=50px"},2000); }
</script>
</body>
</html>
举报