1、javascript ,設置一個變量,只允許提交一次。
<script language="javascript">
var checkSubmitFlg = false;
function checkSubmit()
{
if (checkSubmitFlg == true)
{
return false;
}
checkSubmitFlg = true;
return true;
}
document.ondblclick =
function docondblclick()
{
window.event.returnValue = false;
}
document.onclick =
function doconclick()
{
if (checkSubmitFlg)
{
window.event.returnValue = false;
}
}
</script>
<html:form action="myAction.do"
method="post" onsubmit="return checkSubmit();">
2、javascript,將提交按鈕或者image置為disable
<html:form action="myAction.do"
method="post"
onsubmit="getElById('submitInput')
.disabled = true;
return true;
">
<html:image
styleId="submitInput"
src="images/ok_b.gif"
border="0" />
</html:form>
使用了以上方法后,你會發現,當你表單提交后.再進行多次刷新.數據庫中只有一條.不會多次保存.
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com