I have a form that has a SELECT object. I would like to go to a URL dependent on the choice the user makes.
Something like this:
<select size="1" name="D1" onchange="window.location='http://localhost/test.htm?Choice=this.value'">
What I would like to see is "http://localhost/test.htm?Choice=blue" sent to the browser.
My syntax is wrong, or something. Can someone help me?
Have to run off to eat.
for (i=0; i< selObj.length; i++)
location.href='http://localhost/test.htm?choice=' + selObj.options[i].value;
See the 'Select & Go Menus' script/tutorial at my site for an explanation fo the doSel() function.
I ran a few test and with using your code I developed this, and it works.
<select size="1" name="D1" onchange="window.location=document.all.D1.value">
Within your responses you have demonstrated the exact reason I prefer this forum to the News Groups. When asking a question in the News Groups, the answer is usually a few lines, but the people responding would rather go into a 10 page thesis as to why the person asking the question should have referred to the perldocs, FAQs, etc. The whole purpose of using a forum is to tap the exact people who know the answer to your question.
Both your solutions were exactly what I was looking for.
You shouldn't be too hard on the newsgroup people (I spend time there occasionally :) After all, what they say about checking the faqs and searching are things everyone should attempt first. In forums, a lot of responses are of the "search the forum" and 'follow this link' type. I use those myself once I have enough responses on the forum.