防止表单按钮多次提交
1.
<form name=fm method="POST" action="/"> <p>按钮变灰</p> name: <input type="text" name="name"/> <input type="button" value="提交" onclick="javascript:{this.disabled=true;document.fm.submit();}"> </form>
2.
<form name=fm method="POST" action="/" > <input type="submit" name="Submit" value="提交" id="submitId" onclick="submit();"> </form> <script language="javascript"> function submit() { var submitId=document.getElementById('submitId'); submitId.disabled=true; document.fm.submit(); setTimeout("submitId.disabled=false;",3000); //代码核心在这里,3秒还原按钮代码 } </script>