我有一个工作缓慢的表单,我想在点击后禁用其提交按钮。我做过类似的事情:http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_pushbutton_disabled2。但是现在我的按钮无法发送POST
请求。怎么办?
代码:
<form id="command" action="/smsc/userRole/sms/sendMassSMS" method="POST">
<a href="/smsc/userRole/sms/mass" class="btn btn-danger btn-sm">Нет,
отмена</a>  
<input type="submit" class="btn btn-success btn-sm"
value="Да, отправляем" onclick="myFunction()" id="send">
</form>
<script>
function myFunction() {
document.getElementById("send").disabled = true;
}
</script>
答案 0 :(得分:1)
将myFunction()代码替换为下面的
function myFunction() {
document.getElementById("send").disabled = true;
document.getElementById("command").submit();
}