Javascript 设置超时的重播按钮
我想为我的setTimeout函数创建一个重播按钮 因此,当我单击replay按钮时,它将在不重新加载当前页面的情况下重播转换 我只喜欢javascript试试这种方法Javascript 设置超时的重播按钮,javascript,css,Javascript,Css,我想为我的setTimeout函数创建一个重播按钮 因此,当我单击replay按钮时,它将在不重新加载当前页面的情况下重播转换 我只喜欢javascript试试这种方法 var timeout; function yourTimeoutFunction() { timeout = setTimeout( /* put your code here */ ); } function replayTimeoutFunction() { clearTimeout(timeo
var timeout;
function yourTimeoutFunction() {
timeout = setTimeout( /* put your code here */ );
}
function replayTimeoutFunction() {
clearTimeout(timeout); // clear timeout
yourTimeoutFunction(); // restart timeout
}
当您按下按钮时,让它运行replayTimeoutFunction。请提供您尝试过的代码片段。