有没有我做错了,停止窗体验证?我似乎无法让它在验证框没有被点击时进行验证。使用Javascript验证输入表单
您的帮助将不胜感激。
<html>
<head>
<script type="text/javascript">
function validateTerms(){
valid = true;
if (document.application-form.terms.checked == false){
alert ("Please accept the terms");
valid = false;
}
return valid;
}
</script>
</head>
<body>
<form id="application-form" name="application-form" method="post" action=""><br />
<p><input type="checkbox" name="terms" value="terms" /><b> I have read the <a href="terms.php">Terms</a> *</b>. </p>
<input type="submit" value="Submit Application" onsubmit="return validateTerms()">
<input type="reset" value ="Clear Form" onClick="return confirm('Are you sure you want to reset the form?')">
</form>
</body>
</html>
谢谢,这工作。将需要花更多的时间与Javascript。 –