HTML 代码:
<form action='save.php' method="post" onsubmit="return validate(this)">
some inputs here...
</form>
这里的验证功能正常,但确认代码不起作用。 Javascript 代码:
function validate(theForm)
{
validations here for input fields....
/*confirm dialog*/
var sure = confirm("Are you sure to proceed ?");
if(sure == false)
{
return false;
}
else
{
return sure;
}
}
确认对话框会显示,但是在单击“确定”按钮时,它不会提交表单,是否有办法使用JavaScript函数在确认对话框上提交表单。提前致谢。
return confirm('Are you sure?')
而不是整个if-else检查呢? - tewathia<form onsubmit="return confirm('您确定要继续吗?');">
- Dipesh Parmar