下面显示的 HTML 表单在 Opera(版本:9.52)中无法正常工作。该表单没有 onsubmit 属性,也没有 type=submit 的 input 元素。它只有两个 type=button 的输入元素,它们都 onclick 调用一个 js 方法,我希望用户在其中确认提交。如果我删除 confirm() 调用,它工作得很好。在所有其他浏览器(FF2、FF3、IE7)中它运行良好。
任何指针?
<script type = "text/javascript">
function userSubmit(submitStatus)
{
// Omitted code that uses the parameter 'submitStatus' for brevity
if(confirm('Are you sure you want to submit?'))
document.qpaper.pStatus.value = something;
else
return;
document.qpaper.submit();
}
</script>
<form name = "qpaper" method = "post" action = "evaluate.page">
<input name = "inp1" type = "button" value = "Do This" class = "formbutton" onClick = "userSubmit(false)">
<input name = "inp2" type = "button" value = "Do That" class = "formbutton" onClick = "userSubmit(true)">
</form>