General discussion

Locked

Redirection(Client) w/Select Tag Options

By gjohnson ·
Can anyone show me an example of a client-side, HTML redirection from a <select... <option... tag-set, using javascript? For example,(this doesn't work)(is there a better way?):

<script language = javascript type = "text/javascript">
<!-- function projectManagement(passedForm) {

if (passedForm.URL.selectedIndex <= 0) {
window.alert("You must pick one selection.");
passedForm.course.focus();
passedForm.course.select();
return false;
}

document.location = "passedForm.URL.value";
}
// -->
</script>
</head>
<body>

<form action="" onsubmit="projectManagement(this)" >
<select name="URL" size=1>
<option selected="selected"></option>
<option value="http://www.pmi.org">Project Mgmt Institute (PMI)</option>
</select>

<input type="submit" value="Submit" />
</form>

Many thx.
Gary Johnson
gjohnson@pacbell.net

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Redirection(Client) w/Select Tag Options

by nikki96 In reply to Redirection(Client) w/Sel ...

<script language="javascript" type="text/javascript">
<!--
function projectManagement(passedForm) {

if (passedForm.URL.selectedIndex <= 0) {
window.alert("You must pick one selection.");
passedForm.course.focus();
passedForm.course.select();
return false;
}

location.href = "passedForm.URL[passedForm.URL.selectedIndex].value";
}
// -->
</script>
</head>
<body>

<form name="myFrm" id="myFrm">
<select name="URL" size="1">
<option selected value="_blank">--Choose One --</option>
<option value="http://www.pmi.org">Project Mgmt Institute (PMI)</option>
</select>

<input type="button" value="Submit" onClick="projectManagement(this.form);" />
</form>


HTH
~nikki~

Collapse -

Redirection(Client) w/Select Tag Options

by gjohnson In reply to Redirection(Client) w/Sel ...

The question was auto-closed by TechRepublic

Collapse -

Redirection(Client) w/Select Tag Options

by sachinp78 In reply to Redirection(Client) w/Sel ...

<form action="" name="form" >
<select name="URL" size=1 onChange="window.location=this.options[selectedIndex].value">
<option selected="selected"></option>
<option value="http://www.pmi.org">Project Mgmt Institute (PMI)</option>
</select><input type="submit" value="Submit" />
</form>

Thats ALL

Collapse -

Redirection(Client) w/Select Tag Options

by gjohnson In reply to Redirection(Client) w/Sel ...

The question was auto-closed by TechRepublic

Collapse -

Redirection(Client) w/Select Tag Options

by gjohnson In reply to Redirection(Client) w/Sel ...

Plz accept my apology. I was able to implement the above, w/minor changes, but have not had my nose above water enough this last month to document and respond to each of you... and still will not be able to do so until after 6/26.

I CAN say that your responses were invaluable. Thank you for taking the time out of your busy schedules. More later.
Gary

Collapse -

Redirection(Client) w/Select Tag Options

by gjohnson In reply to Redirection(Client) w/Sel ...

The question was auto-closed by TechRepublic

Collapse -

Redirection(Client) w/Select Tag Options

by gjohnson In reply to Redirection(Client) w/Sel ...

This question was auto closed due to inactivity

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums