NumberTWO Posted April 23, 2006 Share Posted April 23, 2006 Hi,This codes somehow do no open a new windows whenever I click on the option in the dropdown box. Is there anything I can do ? <html><body><div align="center"><form action="employment/dummy" method="post"><select name="choice" size="1" onchange="document.location.href=this.options[this.selectedIndex].value;" > <option value="Select a Country"><b><font face="sans-serif"><font size="3">Select a Country </font></b></option> <option value="http://www.worldvision.org.uk/"><b><font face="sans-serif">United Kingdom </font></b></option> </select></form></div></body></html>Your help is much appreciated. Link to comment Share on other sites More sharing options...
scott100 Posted April 24, 2006 Share Posted April 24, 2006 <select name="choice" size="1" onchange="window.open(this.options[this.selectedIndex].value)" > or simply <select name="choice" size="1" onchange="window.open(this.value)" > Link to comment Share on other sites More sharing options...
raimo Posted April 24, 2006 Share Posted April 24, 2006 edit: removed all, Scott wrotes same as I, again! if need to reset selection: <select name="choice" size="1" onchange="if (this.selectedIndex != 0) window.open(this.value); return this.selectedIndex = 0" > I mean if You have:<option value="#">Select location</option><option value="http://www.fi/">Mother knows everything</option><option value="http://www.ru/">Russia on the Net</option>etc . select will be reseted to Select location option (o) after each changeUse function,Javascript to head part of Your document: <script type="text/javascript"><!--function Open(obj){if (obj.selectedIndex != 0) window.open(obj.value);obj.selectedIndex = 0;}//--></script> HTML:<select onchange="Open(this)"> Link to comment Share on other sites More sharing options...
NumberTWO Posted April 24, 2006 Author Share Posted April 24, 2006 Thanks Scott and raimo..It works, both the reset selection and windows.open .. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now