禁用按钮
- <!DOCTYPE html>
- <html>
- <body>
- <form>
- <input type="button" id="btn01" value="确定">
- </form>
- <p>单击“禁用”按钮以禁用“确定”按钮:</p>
- <button onclick="disableElement()">禁用</button>
- <script>
- function disableElement() {
- document.getElementById("btn01").disabled = true;
- }
- </script>
- </body>
- </html>