<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>全选禁用与取消</title>
<script language="javascript">
function checkall(form)
{
for(var i=0;i<form.elements.length-2;i++)
{
var e=form.elements[i];
if(e.type=='radio')
e.disabled=form.radio[0].checked;
}
}
</script>
</head>
<body>
<center>
<form name="myForm">
<input type="radio" name="box" value="1">1
<input type="radio" name="box" value="2">2
<input type="radio" name="box" value="3">3
<input type="radio" name="box" value="4">4
<input type="radio" name="box" value="5">5
<p> </p>
<input type="radio" name="radio" value="禁用" onClick="checkall(this.form);">
<input type="radio" name="radio" value="重置" onClick="checkall(this.form)">
</form>
</center>
</body>
</html>
本文介绍了一个简单的HTML页面示例,该页面使用JavaScript实现了一项功能:通过单选按钮来禁用或重置页面上的其他单选按钮选项。此功能常用于表单中需要控制用户选择权限的场景。
2407

被折叠的 条评论
为什么被折叠?



