为什么页面是静止的了,不是自己缩放呢,求解
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
#div1{
width: 200px;
height: 200px;
background: red;
border: 10px solid #000;
}
</style>
<script>
window.onload=function(){
startMove();
}
function startMove(){
setInterval(function(){
var oDiv=document.getElementById('div1');
oDiv.style.width=(getStyle(oDiv,'width'))-1+'px';
},30)
}
function getStyle(obj,attr){
if(obj.currentStyle){
return obj.currentStyle[attr];
}
else{
return getComputedStyle(obj,false)[attr];
}
}
</script>
</head>
<body>
<div id="div1"></div>
</body>
</html>