我不确定是什么错误,但是当我在未选中复选框的情况下按下按钮时无法收到警报。有人可以让我知道我在这里犯了什么错误。
<html>
<head>
<script type="text/javascript">
function validator(form) {
if (form.q36.value.length == 0) {
alert("Select one environment");
form.q36.setfocus();
return (false);
}
if (form.q56.value.length == 0) {
alert("Select one environment");
form.q56.setfocus();
return (false);
}
if (form.q77.value.length == 0) {
alert("Select one environment");
form.q77.setfocus();
return (false);
}
if (form.apppath.value.length == 0) {
alert("Enter the path");
form.apppath.setfocus();
return (false);
}
return (true);
}
</script>
</head>
<body>
<form action="/car.java" onsubmit="return validator(this);">
<br />
<p>One
<input name="q36" id="q36" type="checkbox" />Two
<input name="q56" id="q56" type="checkbox" />Three
<input name="q77" id="q77" type="checkbox" />
</p>
<br />
<input name="apppath" size="123" style="width: 766px; height: 21px;" type="text" />
</p>
<p>
<input name="uipath" size="123" style="width: 766px; height: 21px;" type="text" />
</p>
<textarea cols="95" name="status" rows="11"></textarea>
<input name="sub" size="28" style="width: 156px; height: 29px;" type="button" value="Deploy" />
</p>
</form>
</body>
</html>