<script language=JavaScript>
function test(obj)   
{
for (var i = 1; ; i++)
{
var box = document.getElementById("checkbox" + i); if (box != null)
{
box.checked = false;
}
else
{
obj.checked = true; return;
}
}
}
</script>
<html>
<body>
<input type="checkbox" name="checkbox1" value="1" onclick="test(this)" id="checkbox1">
<input type="checkbox" name="checkbox2" value="2" onclick="test(this)" id="checkbox2">
<input type="checkbox" name="checkbox3" value="3" onclick="test(this)" id="checkbox3">
<input type="checkbox" name="checkbox4" value="4" onclick="test(this)" id="checkbox4">
<input type="checkbox" name="checkbox5" value="5" onclick="test(this)" id="checkbox5">
<input type="checkbox" name="checkbox6" value="6" onclick="test(this)" id="checkbox6">
</body>
有个约定,如果想要参于这样行为的CHECKBOX,必须要命名ID,ID有一个规则,命名必须是checkbox + n,而且要连续的。