0
我想提交一個窗體與ONClick。但是,我希望Onclick在繼續提交之前等待1秒鐘。我試圖實現這一點,但表格現在沒有提交。js上點擊等待,然後張貼表格
CODE:
http://pastebin.com/enhL8XwN (不能直接發佈代碼,所以不會提交問題)
我想提交一個窗體與ONClick。但是,我希望Onclick在繼續提交之前等待1秒鐘。我試圖實現這一點,但表格現在沒有提交。js上點擊等待,然後張貼表格
CODE:
http://pastebin.com/enhL8XwN (不能直接發佈代碼,所以不會提交問題)
你結合的情況下到窗體Click事件。嘗試添加另一個按鈕並將事件附加到它。
<form action="voteupdate.php" id="form-id" method="post">
<input type="hidden" name="type" id="type" value="' . $type . '">
<input type="hidden" name="id" id="id" value="' . $id . '">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default '.$vup.'">
<input type="radio" name="vote" id="1" value="1">
<span class="glyphicon glyphicon-chevron-up"></span> Vote up
</label>
<label class="btn btn-default '.$vd.'">
<input type="radio" name="vote" id="2" value="2">
<span class="glyphicon glyphicon-chevron-down"></span> Vote down
</label>
</div>
<input type="button" value="Submit" onclick="setTimeout(function(){ document.getElementById('form-id').submit(); }, 1000)" />
</form>
被毆打秒.... – Liran
按鈕無效 – user2570264
對不起,有一個額外的'}'在年底的onclick之前的'「'。刪除它,因爲我更新的代碼。 –