이 타이머 스크립트를 만들었지 만 ti가 onclick을 시작하도록 만들 수 없습니다.이 타이머를 onclick으로 시작하려면 어떻게합니까
여기 내 전체 코드입니다 :
<script type="text/javascript">
function display(notifier, str) {
document.getElementById(notifier).innerHTML = str;
}
function toMinuteAndSecond(x) {
return Math.floor(x/60) + ":" + x%60;
}
function setTimer(remain, actions) {
(function countdown() {
display("countdown", toMinuteAndSecond(remain));actions[remain] && actions[remain]();
(remain -= 1) >= 0 && setTimeout(arguments.callee, 1000);
})();
}
setTimer(20, {
20: function() {
display("notifier", "seconds");
},
1: function() {
display("notifier", "second");
},
0: function() {
display("notifier", "seconds");
}
}
);
</script>
<!--Start Redirect Countdown-->
<div id="redirect_box" style="display:block;">
Redirecting in <span id="countdown"></span> <span id="notifier"></span>
</div>
<!--End Redirect Countdown-->
<div id="buttonn">Skip >></div>
건너 뛰기 >> 타이머와 ID를 시작하는 버튼이 될 생각되며, 카운트 다운이 실제 카운트 다운입니다. 알림은 추가 ID입니다.
<div id="buttonn">Skip >></div>
이 있어야한다 : 나는이 사람이
을 그래서 당신이 온 클릭을 결합 할 경우 콜백? – mykhal
누군가 다른 사람보다 먼저 언급하는 것이 더 좋습니다 : * arguments.callee *는 ES5 엄격 모드에서 지원되지 않습니다. 나를 귀찮게하지는 않지만 어떤 사람들은 그것에 대해 신음하는 것을 좋아합니다. :-) – RobG