I am writing a simple game and want to add a click
event to the body
element. But the script below does not work. Is there anything I can change to make it work?
var theBody = document.getElementsByTagName("body")[0];
theBody.addEventListener("click", gameOver);
theBody.onclick = gameOver();
function gameOver() {
alert("Game Over!");
}