为什么这样放大不了
为什么这样实现不了呢
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
window.onload = function(){
var maxBtn = document.getElementById("max");
maxBtn.onclick = function(){
maxFun();
}
var img=document.getElementById("imgin");
function maxFun(){
var endwidth=img.width*1.3;
var endheight=img.height*1.3;
var maxTimer = setInterval(function()
{if(img.width<endwidth){img.width=img.width*1.05;
img.height=img.height*1.05;}
else {clearInterval(maxTiimer);}}
,20)
}
}
</script>
</head>
<body>
<div style="width:400px;margin:0 auto">
<img src="logo.jpg" id="imagin" /><br>
<input type="button" id="max" value="放大" />
<input type="button" id="min" value="缩小" />
</div>
</body>
</html>