天天看点

表单提交后禁用按钮

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>表单提交后按钮禁用</title>
<script type="text/javascript">
function sub() {
document.forms[0].elements[0].disabled = true;
//document.getElementByIdx_x('btn').disabled = true;//两种方法都可以实现禁用
document.forms[0].submit();
}
</script>
</head>
<body>
<form action="window1.html" method="post" target="_blank">
<input type="button" name="btn" value="提交表单" onclick="return sub();" />
</form>
</body>      

继续阅读