Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> </head> <body> <form> <fieldset id="myFieldset"> <legend>Personalia:</legend> 用户名: <input type="text"><br> Email: <input type="text"><br> 出生日期: <input type="text"> </fieldset> </form><br> <button onclick="disableField()">禁用 fieldset</button> <button onclick="undisableField()">取消禁用 fieldset</button> <p><b>注意:</b>Internet Explorer 和 Safari 不支持 Fieldset 对象的 disabled 属性。</p> <script> function disableField(){ document.getElementById("myFieldset").disabled=true; } function undisableField(){ document.getElementById("myFieldset").disabled=false; } </script> </body> </html>