Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
60
rated 0 times [  67] [ 7]  / answers: 1 / hits: 38442  / 13 Years ago, thu, november 3, 2011, 12:00:00

I'm sure this shouldn't be so hard!



I've been struggling with facebook's javascript: I need to redirect to a URL based on the value in a select drop down menu, something like:



<form name=cityselect>
<select name=menu onChange=location=document.cityselect.menu.options[document.cityselect.menu.selectedIndex].value; value=GO>
<option value=http://www.leeds.html>Leeds</option>
<option value=http://www.manchester.html>Manchester</option>
</select>
</form>


Can anybody help me get this working? I've had good look though the facebook dev forum and docs but either don't understand what needed or can't find the answer!


More From » facebook

 Answers
36

Try {} this.options also your urls are mistyped. http://www.leeds.html should be http://www.leeds.com , not sure if that is related but just wanted to point that out just in case.






<form name=cityselect>
<select name=menu onChange=window.document.location.href=this.options[this.selectedIndex].value; value=GO>
<option selected=selected>Select One</option>
<option value=http://www.leeds.com>Leeds</option>
<option value=http://www.manchester.com>Manchester</option>
</select>
</form>





Parent Frame:



<form name=cityselect>
<select name=menu onChange=top.location.href=this.options[this.selectedIndex].value; value=GO>
<option selected=selected>Select One</option>
<option value=http://www.leeds.com>Leeds</option>
<option value=http://www.manchester.com>Manchester</option>
</select>
</form>

[#89309] Wednesday, November 2, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
trayvon

Total Points: 35
Total Questions: 117
Total Answers: 88

Location: Guernsey
Member since Tue, Jul 6, 2021
3 Years ago
;