【发布时间】:2025-11-28 06:20:06
【问题描述】:
当我从浏览器关闭此页面时,会打开一个警告框,询问“离开此页面”或“留在此页面上”这没关系。但是,当从下方给出的提交按钮提交表单时,再次询问并显示此警告框。我如何在提交表单时禁用它不应该询问并显示警告框??
<script>
window.onbeforeunload = function(e) {
return 'You application form is not submitted yet.';
};
WinPrint.document.write('<span style="font-size:22px">' + prtContent.innerHTML + '<span>');
</script>
<div>
<input type="submit" name="" class="button" value="Save Your Application Form" onclick="if(document.getElementById('thumb').value=='') { alert('Please select your photograph.'); return false; } return confirm('Read your application form thoroughly before submitting, Once submitted data, it will not changed in any case, press OK to submit or press CANCEL to make corrections.'); return false;" style="text-align:center !important; float:none !important;"/>
</div>
【问题讨论】:
标签: javascript php jquery html forms