<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