Once #theButton
is clicked, an alert should be triggered. Why aren't any of the events being triggered using the following methods? Thanks in advance.
<html>
<head>
<script type="text/javascript" language="javascript">
var theButton = document.getElementById("theButton");
theButton.onclick = function(){alert("Clicked!");}
theButton.onclick = clickAlert;
theButton.onclick(alert("Clicked!"));
function clickAlert(){
alert("Clicked!");
}
</script>
</head>
<body>
<input type="button" id="theButton">
</body>
</html>