<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool教程(w3cschool.cn)</title>
</head>
<body>
<form>
<fieldset id="myFieldset">
<legend>Personalia:</legend>
用户名: <input type="text"><br>
Email: <input type="text"><br>
出生日期: <input type="text">
</fieldset>
</form>
<p>点击下面的按钮禁用上面的 fieldset。</p>
<p id="demo"></p>
<button onclick="myFunction()">尝试一下</button>
<p><b>注意:</b>Internet Explorer 和 Safari 不支持 Fieldset 对象的 disabled 属性。</p>
<script>
function myFunction(){
document.getElementById("myFieldset").disabled=true;
}
</script>
</body>
</html>