我正在使用下面的代碼將值提交給我的數據庫。如何防止在窗體上單擊多個按鈕
<input id="btn_'.$temp['id'].'" value="Confirm" style="background: #409940; border-radius: 10px; color: white;" type="button" onclick="validaLink(\''.$temp['id'].'\');">
問題:
在2秒,多次點擊都使用相同的值提交,直到DIV潮流了。
我做了什麼:
我試圖在提交後禁用表單按鈕。但我想2個onclick事件不起作用。
建議/代碼更正請
考慮尋找到使用會話和令牌http://www.phpro.org/tutorials/Preventing-Multiple-Submits.html作爲服務器側方法中,在與下面的其他意見結合使用。 – 2014-09-18 19:05:42
onclick =「javascript:window.open(\''。$ temp ['shorten']。'\'); this.disabled = true;」 – 2014-09-18 19:06:35
也許加上this.disabled = true;在你的window.open之後(\''。$ temp ['shorten']。'\'); – 2014-09-18 19:06:42