Click to See Complete Forum and Search --> : Pulldown Menu that opens a new window...


weatherman2525
09-10-2003, 07:42 PM
Hi,

I do not know to much about Javascript and I am using 2 dropdown menus on one page and when you select an item from either menu it opens it up in a new window. My problem/question is when I select another item from the same or other menu it uses the same window that it opened up for the first item. Is it possible for each item you select it opens a new window and not the first one it opened? If so, please let me know the code.

Here is the example page:
http://www.adamsweather.com/popupmenus.htm

Thanks in advance,
Adam

Exuro
09-10-2003, 08:34 PM
So you want the pages to open in new windows every time? If so, simply change the code as follows:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function form1Handler(form1) {
var URL = form1.site1.options[form1.site1.selectedIndex].value;
popup = window.open(URL,"");
}
// End -->
</script>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function form2Handler(form2) {
var URL = form2.site2.options[form2.site2.selectedIndex].value;
popup = window.open(URL,"");
}
// End -->
</script>


Notice how I removed "MenuPopup" from the window.open()s. This makes it so that a window isn't specified, so it just opens in a new window every time. I hope that works for you!

weatherman2525
09-10-2003, 09:17 PM
Hi,

Yes, that is exactly what I needed. Thank you very much. Your help was very much appreciated.

Thanks a million and take care,
Adam

pyro
09-10-2003, 09:42 PM
Note that the language attribute for the <script> tag has been depreciated. Use instead: <script type="text/javascript">