I'm working on a page that should redirect depending on what the user enters in the form, and I can't seem to figure it out. New to Javascript, and eager to learn!
Here is the html:
<body>
<div id="header">
<div id="navcontainer">
<ul>
<li> <a href="#item1">Home</a> </li>
<li> <a href="#item2">Scents</a> </li>
<li> <a href="#item3">About</a> </li>
<li> <a href="#item4">Contact</a> </li>
</ul>
</div>
</div>
<div id="content">
<p>Hi, how are you feeling today?</p>
<form> <input id="feels" type="text" name="feeling" size="35" onchange="checkfeels(#feels.value);">
<input type="submit" value="submit" >
</form>
</div>
And the Javascript I have so far:
function checkfeels(myFeels) {
switch (myFeels)
{
case "good":
document.location.href = 'scents.html';
break
case "bad":
alert(2);
document.location.href = 'scents2.html';
default:
alert("whatever");
}
}
Any help is really appreciated, thanks!