I created two webpages and the Entrance page is supposed to prevent under aged users from entering the webpage, almost like a password page. I got the submit button to do almost everything it is supposed to do, except sending the user to the next page. Could somebody please help me solve this issue?
here is the code for the Entrance page:
<!DOCTYPE html>
<html>
<head>
<!-- this is how you add a code comment-->
<title> Entrance Page </title>
</head>
<body bgcolor="#CEF6F5">
<form>
<h2 align=center><u> Please fill out the following information to proceed to the festival: </u></h2>
<br><br>First Name:<input type="text" name="First Name" id="first"> Last Name:<input type="text"
name="Last Name" id="last">
<br><br> age:<select name="age" id="age">
<option value="1"> below 10 </option>
<option value="2"> 10 </option>
<option value="3"> 11 </option>
<option value="4"> 12 </option>
<option value="5"> 13 </option>
<option value="6"> 14 </option>
<option value="7"> 15 </option>
<option value="8"> 16 </option>
<option value="9"> 17 </option>
<option value="10"> 18 </option>
<option value="11"> 19 </option>
<option value="12"> 20 </option>
<option value="13"> above 20 </option>
</select>
<br><br><br>
<p align="center"> <button type="submit" onclick="run()"> Submit </button> </p>
</form>
<p><p align=center><img src="oktoberfest(4).jpg" hight="600" width="1200" border="3"></p>
<a href="Cost%20of%20an%20Event.html" id="pass"> </a>
<a href="Cost%20of%20an%20Event%20Entrance%20page.html" id="block"> </a>
<p><p id="p1"> </p>
<script>
var firstName = document.getElementById("first").value
var lastName = document.getElementById("last").value
var age = +document.getElementById("age").value
var isNum = " ";
isNum = isNum + isNaN(firstName)
function run() {
var firstName = document.getElementById("first").value
var lastName = document.getElementById("last").value
var age = +document.getElementById("age").value
if (age < 10) {
window.alert("your too young to enter in this event!")//go back to Entrance page
} else if (age > 10) {
window.alert("welcome to the Oktoberfest website!");
window.location.replace("Cost%20of%20an%20Event.html");//go to main website
} else if (age == 10) {
window.alert("lucky! you are just barely old enough to join!")
window.location.replace("Cost%20of%20an%20Event.html");//go to main website
}
}
if (isNum == true) {
window.alert("your name cannot be a number");
}//go back to Entrance page
/* while (firstName.length ==0) {
window.alert ("you didn't enter a first name ")
document.getElementById("block").value//go back to Entrance page
while (lastNamet.length ==0) {
window.alert ("you didn't enter a last name ")
document.getElementById("block").value//go back to Entrance page
*/
</script>
</body>
</html>