天天看點

表單送出後禁用按鈕

<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>      

繼續閱讀