Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redirection from a combo box.

Status
Not open for further replies.

scroce

MIS
Nov 30, 2000
780
US
I've seen this done before, but I'm not sure if it's done better with javascript or ASP - So I'm posting this message in both areas.

I have a combo box on a form with 5 choices in it.

If the user chooses choice1, then I want the browswer to redirect to page1.html, if the user chooses choice2, then I want the browser to redirect to page2.html etc. etc..

However I don't want to have a "submit" button, i just want the redirection to occur upon update of the combo box - which is why I think it might be javascript,, right?

simple enough? - but I'm confused on whether this is a client side or server side issue - do I use the "onafterupdate" event in javascript, Is there something like a select case statement in javascript i can use to capture the user's selection?

Does anyone have an example of this being done that I can look at

Thanks. How much more water would there be in the ocean if it weren't for sponges?
 
ASP is server side which cannot control what the user is currently doing on the client side. The only way you could do it through ASP is to submit the page to the server and request the form value.

Use javascript,

<script language='javascript'>
<!--
function goThere(){
var dest = document.theForm.destination.value;
window.location.href = dest;
}
// -->
</script>


Select what you want to find out about more:<BR>

<form name='theForm'>
<select name='destination' onchange='goThere()'>
<option value=''></option>
<option value='page1.asp'>Apples</option>
<option value='page2.asp'>Orages</option>
<option value='page3.asp'>Bannanas</option>
</select>
</form>
-Ovatvvon :-Q
 
thanks. I really appreciate the help. How much more water would there be in the ocean if it weren't for sponges?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top