javascript radio 全选禁用与取消

来源:互联网 发布:淘宝直播在哪里申请 编辑:程序博客网 时间:2024/06/05 16:16

<!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>&nbsp;</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>

原创粉丝点击