here is the code, in the console it is telling me that button is null.
<!doctype html>
<html>
<head>
<script language="JavaScript" type="text/javascript" src="test.js"></script>
</head>
<body>
<button type=button id="button">Click me</button>
</body>
</html>
Here is the javascript test.js
function showAlert(){
alert("this is an alert");
}
var button = document.getElementById("button");
button.addEventListener("click", showAlert);