我已使用此代码在表单上设置验证,以便在未检查所有按钮时提醒我!..但是当我尝试它时,即使检查了所有按钮,它也会给我错误警报..请帮忙?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript">
function validateForm(formData){
if(!this.v1.checked && !this.v2.checked && !this.v3.checked){
alert('answer all questions please');
return false;
}
return true;
}
</script>
<title></title>
</head>
<body>
<form name="form1" action="mark.php" onsubmit="return validateForm()" method="post">
<input type="radio" value="1" id="v1" name="v1"> <input type="radio" value="1" id="v2" name="v2"> <input type="radio" value="1" id="v3" name="v3"> <input type="submit" value="Send">
</form>
</body>
</html>