这里用到的是localStorage
,localStorage
是一种持久性的本地存储,可以存储键值对,使用JavaScript API
来访问和存储数据,存储的数据没有时间限制,除非用户手动删除它们。
使用方法也很简单:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<button id="clickButton" onclick="limitClick()">Click Me</button> <script> let count = localStorage.getItem('count') || 0; function limitClick() { if (count < 2) { count++; localStorage.setItem('count', count); alert('You have clicked this button ' + count + ' times'); } else { document.getElementById('clickButton').disabled = true; alert('You have reached the limit of clicking this button!'); } } </script> |
最新评论
加个QQ好友2062886936,高价回收,想出售随时可以找我吗
不错,想用
能用吗
6啊
该评论为私密评论
域名卖吗?加个QQ864716046好友,长期收域名,想卖随时可以找我
谢谢分享
WireGuard配置文件还有吗