为什么写了这句之后,在我的浏览器里就不运动了oDiv1.style.width=parseInt(oDiv1.style.width)-1+'px';
<html>
<head>
<title>任意属性值</title>
<meta charset="utf-8">
<style type="text/css">
#div1{
width:200px;
height:200px;
background:red;
border:4px solid #000;
}
</style>
<script type="text/javascript">
window.onload=function(){
startMove();
}
function startMove(){
setInterval(function(){
var oDiv1=document.getElementById('div1');
//oDiv1.style.width=oDiv1.offsetWidth-5+'px';
oDiv1.style.width=parseInt(oDiv1.style.width)-1+'px';
},30)
}
</script>
</head>
<body>
<div id="div1"></div>
</body>
</html>