<body> <div id="aa"> <img id="myimage" src="66.JPG"><br> <input type="button" id="max" value="放大"> <input type="button" id="min" value="缩小"> </div> <script> window.onload=function(){ var maxbut=document.getElementById("max"); maxbut.onclick=function(){ maxfun(); } var img=document.getElementById("myimage"); var endwidth=img.width*1.1; var endheight=img.height*1.1; function maxfun(){ var maxtime=setInterval(function(){ if(img.width<endwidth){ img.height=img.height*1.05; img.width=img.width*1.05; } else{ clearInterval(maxtime); } },1000); } } </script></body>
添加回答
举报
0/150
提交
取消