Web Hosting Talk







View Full Version : Simple redirection question


jlee2301
08-09-2004, 12:54 PM
Hi guys

I have a page with a form as folows:

<form name="myform" action="" method="post">
<select name="select">
<option>Add</option>
<option>Delete</option>
<option>Edit Project</option>
</select>
<input type="submit" name="submit" value="Select" onClick="option();"></form>


All I want to do is when somone chooses one of the options in the drop down box, and clicks the submit button, they are taken to the specific page already created for each option. I started off trying javascript and defining the option() function in the header trying something like:

<script language="JavaScript">
function option(){
if document.myform.select.selectedindex == 0
{
window.location="add.php");
}
else if document.myform.select.selectedindex == 1
{
window.location="delete.php";
}
}
etc etc

I just cant get it to work - any ideas?

sellkraft
08-09-2004, 06:34 PM
you may find this navigation useful, it is compatible with all browsers IE, Netscape and Opera. There will be no submit button choose something to jump to it. It is very simple and easy to customize, add more links in the same format

use this in the body of the page and postion it where you want by the normal means.

<form name="jump">
<select name="menu"
onchange="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;"
value="GO">
<option value="addproject.html">Add Project</option>
<option value="editproject.html">Edit Project</option>
<option value="deleteproject.html">Delete Project</option>
</select>
</form>

jlee2301
08-10-2004, 07:37 AM
Thanks that worked really well

Hevia
08-12-2004, 04:37 PM
gonna use that

overulehost
08-13-2004, 02:56 AM
jumps menu is by far the best, but not always useful ;)