I have a dynamic combo box which has the URL as the value. I need to connect to the URL once the particular item is get selected.
This is my code.
othercompaniesli.innerHTML= '<select onchange="document.location.href(this.value);"> <option VALUE="http://google.com" >Google</option> <option VALUE="http://google.com" >TEST 1</option> <option VALUE="http://google.com" >TEST</option> </select>';
Here once the Google is selected it need to take the gogle page. the above code is working in iexplorer7 and not working in chrome and firefox. Can any one help me where i made a mistake.
Instead of “this.value”, try “this.options[this.selectedIndex].value”…
EDIT… it’s not the above, it’s the document.location.href… you’re calling it as a function, it should be an assignment: