Can anyone tell me how to disable the submit button after it has been pressed 20 times?
The HTML
runs like this: <input type=submit name='sub' value='submit' onClick='this.disabled=true;return true;doSection(loading);'>
and this code <p><input type="submit" name="submit" value="Submit" disabled /></p>
What should I do so that after pressing the button 20 times, it is dsabled?
任何人都有一些脚本在按下[关闭]后禁用提交按钮
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
4条回答 默认 最新
- dth20986 2013-07-18 23:47关注
You can have a counter that gets updated with every click on the button, when the counter has reached 20, disable it:
count = 0; button = document.getElementsByTagName("input")[0] /*assuming it's the only submit button in the page */ button.onclick = function() { count++; if (count == 20) { this.disabled = true; } };
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 html5+css有人可以帮吗?
- ¥30 Unity接入微信SDK 无法开启摄像头
- ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
- ¥20 cad图纸,chx-3六轴码垛机器人
- ¥15 移动摄像头专网需要解vlan
- ¥20 access多表提取相同字段数据并合并
- ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
- ¥20 Java-Oj-桌布的计算
- ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
- ¥20 有人知道这种图怎么画吗?