页面关闭时计数器不会重置
我正在寻找一些简单的脚本来显示标题所说的内容。某种计数器(如计时器),当用户单击按钮时开始递增,并在再次单击或关闭页面时停止。但它必须保存最后一个值,以便稍后再次打开时从那里开始添加。
我希望它不会太难解决,因为我刚刚开始使用 PHP 和 Javascript。这是一个艺术项目,因此我们将非常感谢任何帮助。 来自阿根廷的问候!
I'm looking for some simple script to display what the title says. Some sort of counter (like a timer) that starts incrementing when the user clicks a button and stops when clicked again or when the page is closed. BUT it has to save the last value to start adding from there when opened again later.
I hope it's not too hard to solve since I am just starting with PHP and Javascript. It is for an art project so any help will be very appreciated.
Greetings from Argentina!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为此,我有一个非常简单的数据库,它存储最后的时间值和时钟的状态。可以在页面加载时对其进行查询,以了解计数器是打开还是关闭,并从存储的时间恢复。
希望这能让您了解需要做什么。祝项目顺利:)。
For this I'd have a very simple database which stores the last time value and the state of the clock. It can be queried on page load to find out if the counter is on or off and resume from the stored time.
Hope this gives you an idea of what needs to be done. Good luck with the project :).