function Click(e) { var haco = document.getElementsByTagName('haco'); haco.target.document for (let i of document.querySelectorAll("haco")) { i.addEventListener("click", stopCountDown, false) } } (() => { function CountDown() { var timer = 4, tmID, infobox = document.getElementById("info"); function countDown() { if (--timer == 0) { infobox.innerHTML = "間違いありま千と千尋の神隠し!!"; } else { infobox.innerHTML = "あと" + timer + "秒"; tmID = setTimeout(countDown,1000); } } function startCountDown() { tmID = setTimeout(countDown, 1000); start.removeEventListener("click", startCountDown, false); haco.addEventListener("click", stopCountDown, false); } function stopCountDown() { clearTimeout(tmID); infobox.innerHTML = "事実は一つですから"; haco.removeEventListener("click", stopCountDown, false); } start.addEventListener("click", startCountDown, false); } document.addEventListener("DOMContentLoaded", CountDown, false); })(); /*var random = Math.floor(Math.randam()*10); var haco = results[random];*/