gpt4 book ai didi

javascript - 如何在 onClick 上启动计时器而不是直接在 onLoad 上启动计时器

转载 作者:行者123 更新时间:2023-12-01 00:08:34 24 4
gpt4 key购买 nike

我想在单击 Canvas 下的“Envoyer”时启动它。

如果你看看我的计时器在 storage.js 中的源

const resa = new Reservation();
document.getElementById("starttimer").onclick = resa.timer();

还有我的 HTML:

    <div id="starttimer"><button type="button" onclick="Save()">Envoyer</button></div>

最佳答案

document.getElementById("starttimer").onclick = function() { resa.timer(); }

关于javascript - 如何在 onClick 上启动计时器而不是直接在 onLoad 上启动计时器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60207793/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com