- Code: Select all
<form action="" method="post">
<p>
<label>name</label>
<input name="dname" value="Your name" type="text" size="30" />
<br /><br />
<input type="submit" value="Submit" onclick="displaypage()/>
</p>
</form>
Now i want if the name entered in the input is "paul" and the user click the submit button the browser to go and display in the same window the paul.html page else if the name entered in the input is "jim" and the user click the submit button the browser to go and display in the same window the jim.html page.I suppose i have to make something like this in the head section of index.html page
- Code: Select all
<script type="text/javascript">
function displaypage()
{
switch(n)
{
case 1:
paul.html
break;
case 2:
jim.html
break;
default:
alert("Wrong Name");
}
}
</script>
Any suggestions how the above may work?



