我正在使用此处的http://webcheatsheet.com/javascript/form_validation.php
进行Javascript表格验证当我提交表单时,验证尚未完成。使用firebug,我收到以下错误(但是我必须在显示确认页面之前按下escape)
fld未定义validateEmail(fld = undefined)(第3178行) validateFormOnSubmit(theForm = form#form1 /account.php)(第3137行) onsubmit(event = submit)
(3178超出范围346)
第3178行基本上是这段代码
<option value="Tester, Developer, Fisherman and Hunter" >Tester, Developer, Fisherman and Hunter</option>
和3171就是这个
<option value="Accommodation and Food Services" >Accommodation and Food Services</option>
有人可以帮我这个。
答案 0 :(得分:0)
function validateEmail()
{
...
var vle = validateEmail;
return !!vle.fld;
}
function validateFormOnSubmit()
{
if (this.validateEmail && this.validateEmail() )
{
document.querySelector("#form1").submit();
}
else
{
...
}
}