<input type="checkbox" id="PM" style="float: left;" onclick="ValidateCheckBox(this)" />
<script type="text/javascript">
function ValidateCheckBox(source) {
alert("HERE!")
var checkbox1 = document.getElementById('AMPM');
checkbox1.checked = false;
var checkbox2 = document.getElementById('AM');
checkbox2.checked = false;
var checkbox3 = document.getElementById('PM');
checkbox3.checked = false;
$(source).attr('checked', true);
var hdn1 = document.getElementById('timeAMPM');
var hdn2 = document.getElementById('timeAM');
var hdn3 = document.getElementById('timePM');
hdn1.value = checkbox1.checked;
hdn2.value = checkbox2.checked;
hdn3.value = checkbox3.checked;
}
</script>
无法调用 JS 函数。我也尝试过 onchange 。现在我添加了孔功能。我有 3 个复选框,我想要的总是只检查一个!我在浏览器的控制台中遇到错误:RefferenceError: $document is not defined