<!DOCTYPE>
<html>
<head>
<title>实现复选框的单选效果</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>
</body>
</html>
<script language="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>

posted on 2017-08-21 17:17  程序小院  阅读(260)  评论(0编辑  收藏  举报