| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | 
							- <!DOCTYPE html>
 
- <html lang="en">
 
-   <head>
 
-     <meta charset="UTF-8" />
 
-     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 
-     <title>Document</title>
 
-     <style>
 
-       * {
 
-         margin: 0;
 
-         padding: 0;
 
-       }
 
-       .box {
 
-         width: 200px;
 
-         height: 200px;
 
-         background: #ff0;
 
-       }
 
-     </style>
 
-   </head>
 
-   <body>
 
-     <div class="box"></div>
 
-     <br /><br />
 
-     <button id="btn1">放大</button>
 
-     <br />
 
-     <br />
 
-     <button id="btn2">缩小</button>
 
-     <script>
 
-       var box = document.querySelector(".box");
 
-       var btn1 = document.getElementById("btn1");
 
-       var btn2 = document.getElementById("btn2");
 
-       btn1.onclick = function () {
 
-         var timer = setInterval(function () {
 
-           box.style.width = box.offsetWidth + 5 + "px";
 
-           if (box.offsetWidth >= 400) {
 
-             clearInterval(timer);
 
-           }
 
-         }, 100);
 
-       };
 
-       btn2.onclick = function () {
 
-         var timer = setInterval(function(){
 
-             box.style.width = box.offsetWidth - 5 + "px";
 
-             if(box.offsetWidth <= 200) {
 
-                 clearInterval(timer);
 
-             }
 
-         },100)
 
-       }
 
-     </script>
 
-   </body>
 
- </html>
 
 
  |