I'm trying to separate my scripts and styling from my markup, but I can't seem to get away from an onclick attribute. From all the searching I've done on Google and StackOverflow, this script should work. How do I make the onclick event completely separate from my markup?
<!DOCTYPE html>
<html>
<head>
<script>
document.getElementById('guest_button').onclick = function () {
document.write('You\'re a guest!');
}
</script>
<title>Test</title>
</head>
<body>
<div id="prompt-container">
<form>
<input id="guest_button" type="button" value="Guest">
<input type="button" value="Login">
<input type="button" value="Sign Up">
</form>
<div id="test"></div>
</div>
</body>
</html>