Click to See Complete Forum and Search --> : function does not work with Netscape, works OK with IE, Mozilla


stanleye
01-15-2003, 12:42 PM
I have a script that works fine with IE 6.0 and Mozilla, but not with my Netscape 4.49.
Can anyone give me a clue here?

I get error message in Netscape:

document.forms[0].Month has no properties.

Here is script:

<SCRIPT Language='JavaScript'>

function ShowMap() {
Month = document.forms[0].Month.options[document.forms [0].Month.selectedIndex].value;
Day = document.forms[0].Day.options[document.forms[0].Day.selectedIndex].text;
Year = document.forms[0].Year.options[document.forms[0].Year.selectedIndex].text;

document.open('http://docs.lib.noaa.gov/rescue/dwm/' + Year + '/' + Year + Month + Day + '.djvu','_blank','','false');


}

gil davis
01-15-2003, 01:06 PM
Originally posted by stanleye
Can anyone give me a clue here?
Not without the rest of the page. Post a link.

stanleye
01-16-2003, 01:42 PM
The link below will take you to the page in question. When you click the button to retrieve the map in question you will get message

document.forms[0].Month has no properties.

By the way, I discovered it works fine with Netscape 7.0. It just doesn't work with Netscape 4.x.

The page in question:

http://docs.lib.noaa.gov/rescue/dwm/data_rescue_daily_weather_maps.html

Any help appreciated--I am quite new at this scripting stuff.

gil davis
01-16-2003, 05:50 PM
NS 4.x does not recognize "ID" on a form element. If you use "NAME", all the browsers will work.

Also, instead of "document.forms[0]", you should name your forms and use the name to access the form. That way, if you ever change the page, you don't have to worry about changing forms order.