fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.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>
运行结果