防止表单重复提交
第一步:
在<head>区添加以下代码
<script>
/*****************************************************
* Share JavaScript (http://www.ShareJS.com)
* 使用此脚本程序,请保留此声明
* 获取此脚本以及更多的JavaScript程序,请访问 http://www.ShareJS.com
******************************************************/
function submitonce(theform){
if (document.all||document.getElementById){
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
tempobj.disabled=true
}
}
}
</script>
第二步:
在<body>区添加表单信息
<form name="form2" method="post" action="" onSubmit="submitonce(this);return false"> <input type="text" name="textfield"> <input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重设"> 提示:按下提交按钮后,看看有什么不同? </form>




