1.表单
<form id="addForm" onsubmit="getElementById('submitInput').disabled=true;return true;" action="save.do" method="post">
用户名:<input type="text" name="userName" id="userName" />
用户密码:<input type="password" name="userPass" id="userPass" />
<input type="button" id="submitInput" onclick="javascript:save()" value="提交" />
</form>
2.js代码
// 打开增加界面
function toAdd() {
// 移除掉disabled属性
$("#submitInput").removeAttr("disabled");
......
} // 提交表单
function save(){
// 提交之后,移除掉disabled属性
$("#addForm").submit();
$("#submitInput").removeAttr("disabled");
}