禁用按钮

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <form>
  6. <input type="button" id="btn01" value="确定">
  7. </form>
  8.  
  9. <p>单击“禁用”按钮以禁用“确定”按钮:</p>
  10.  
  11. <button onclick="disableElement()">禁用</button>
  12.  
  13. <script>
  14. function disableElement() {
  15. document.getElementById("btn01").disabled = true;
  16. }
  17. </script>
  18.  
  19. </body>
  20. </html>