<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>复选框checkbox类似单选按钮radio</title>
</head>
<body>
<form method=post action="">
<input type="checkbox" name="aa" onclick="bb(this)">
<input type="checkbox" name="aa" onclick="bb(this)">
<input type="checkbox" name="aa" onclick="bb(this)">
<input type="checkbox" name="aa" onclick="bb(this)">
<input type="checkbox" name="aa" onclick="bb(this)">
</form>
<script src="js/jQuery-2.2.0.min.js"></script>
<script type="text/javascript">
function bb(obj){
var aa = document.forms[0].aa;
for (var i = 0; i < aa.length; i++) {
aa[i].checked = false;
}
obj.checked = true;
}
</script>
</body>
</html>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2021-11-18
  • 2021-12-04
  • 2021-08-27
  • 2021-08-25
猜你喜欢
  • 2021-09-15
  • 2022-12-23
  • 2021-07-12
  • 2021-07-23
  • 2022-12-23
  • 2022-02-14
  • 2021-08-01
相关资源
相似解决方案