REVscene Automotive Forum

REVscene Automotive Forum (https://www.revscene.net/forums/)
-   Gaming, Computer Tech & Electronics (https://www.revscene.net/forums/gaming-computer-tech-electronics_32/)
-   -   Need Javascript help (https://www.revscene.net/forums/690911-need-javascript-help.html)

Spoon 12-05-2013 09:52 AM

Need Javascript help
 
Kind of noob when it comes to javascript. Can anyone help me out and edit the following code so it would open a new window when one of the options get clicked? It's currently opening in the same window.

-------------------

<form name="cityselect">

<select name="menu" onChange="window.document.location.href=this.optio ns[this.selectedIndex].value;" value="GO">

<option selected="selected">Select a City</option>

<option value="http://www.vancouver.com">Vancouver</option>

<option value="http://www.calgary.com">calgary</option>

<option value="http://www.edmonton.com">Edmonton</option>

</select>

</form>

-------------------
Thanks!

Note: not sure why there's a space placed between the word options when I publish the post, but it's not suppose to be there.

iamed 12-05-2013 10:38 AM

Use window.open instead:

<select name="menu" onChange="window.open(this.options[this.selectedIndex].value);" value="GO">


Quote:

Originally Posted by Spoon (Post 8375766)
Kind of noob when it comes to javascript. Can anyone help me out and edit the following code so it would open a new window when one of the options get clicked? It's currently opening in the same window.

-------------------

<form name="cityselect">

<select name="menu" onChange="window.document.location.href=this.optio ns[this.selectedIndex].value;" value="GO">

<option selected="selected">Select a City</option>

<option value="http://www.vancouver.com">Vancouver</option>

<option value="http://www.calgary.com">calgary</option>

<option value="http://www.edmonton.com">Edmonton</option>

</select>

</form>

-------------------
Thanks!

Note: not sure why there's a space placed between the word options when I publish the post, but it's not suppose to be there.


Spoon 12-05-2013 10:45 AM

Worked like a charm.

Thank you a thousand times if I could. :)


All times are GMT -8. The time now is 11:27 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
SEO by vBSEO ©2011, Crawlability, Inc.
Revscene.net cannot be held accountable for the actions of its members nor does the opinions of the members represent that of Revscene.net