Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple redirect to URL from select drop down in FACEBOOK iframe

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!

like image 876
matt_50 Avatar asked Dec 03 '22 06:12

matt_50


1 Answers

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>
like image 88
ShawnDaGeek Avatar answered Dec 26 '22 06:12

ShawnDaGeek