1、javascript ,設(shè)置一個(gè)變量,只允許提交一次。
<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>
使用了以上方法后,你會(huì)發(fā)現(xiàn),當(dāng)你表單提交后.再進(jìn)行多次刷新.數(shù)據(jù)庫中只有一條.不會(huì)多次保存.
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com