I am trying to create a simple checkbox and button that will verify that a user has read a TOS. For some reason, my code doesn't work. Page loads, but pressing the button doesn't have the desired effect. Firebug says I'm error free, so I figure I'm misunderstanding how something works. Can anyone explain what I'm doing wrong here? I'm still pretty new to Javascript.
<html>
<head>
<script language="javascript" type="text/javascript">
function validateForm()
{
if(document.getElementById("TOSbox").checked)
{
window.location.href = "/give.html";
}
else
{
document.getElementById("TOSWarning").innerHTML="You need to agree to the TOS first.";
}
}
</script>
</head>
<body>
This is where the TOS goes.
<br>
<form name="TOSform" action="">
<input type="checkbox" name="TOSbox" value="checked">I have read and agree to the Terms of Service.<br>
<button onclick="validateForm()">I Agree</button>
</form>
<p id="TOSWarning"></p>
</body>
</html>