是attr那里不对?还是偷懒写法不对呢?
<!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>
<link href="style.css" rel="stylesheet" type="text/css" />
<style>
.ipt{
margin-top:100px;
}
span{
position:absolute;
width:80px;
height:80px;
background-color:yellow;
border:3px solid pink;
vertical-align:middle;
}
</style>
</head>
<body>
<h3>JQuery动画特笑~.~</h3>
<span></span>
<input id="move" class="ipt" type="button" value="左移"></input>
<script type="text/javascript">
$(function(){
$("#move").bind('click',function(){
if($("#move").val=="左移"){
$("#move").animate({
left:"-=50"
},3000);
$("#move").attr("value","右移");
}
else{
$("#move").animate({
left:"+=50"
},3000);
$("#move").attr("value","左移");
}
});
})
</script>
</body>
</html>