...

View Full Version : Script not working in Netscape but working in IE



mrglowurm
06-11-2003, 04:19 PM
Please could you have a look at my script and help me out - basically I've re-directed my form to a popup window displaying confirmation that all the fields are correctly filled out - this works absolutely brilliant in IE but the table is not showing up in Netscape - I ran an error check and Netscape came up with the following error: Line 129 - Form1 not Defined.

I was really hoping I could get this to work in both browsers and I can't see why it shouldn't, problem is I'm not too familiar with javascript.

I would really appreciate any help or ideas on this - try my script out in IE and see how great it is!!!

Kind regards
Nick

jalarie
06-11-2003, 05:49 PM
The reference to 'Form1' is in the popup window, but the definition is in the main window. You need something like 'parent.document.Form1...' in the popup.

mrglowurm
06-11-2003, 06:19 PM
Jalarie,

Thanks ever so much for your help - really do appreciate it - it is now working perfectly in both IE and Netscape!!!

I can't believe how fussy Netscape can be!!

Kind regards
Nick

jalarie
06-11-2003, 06:22 PM
Netscape is forcing you to do it right; IE is allowing you to be sloppy. I design in NS and then check it in other browsers and seldom need any changes.

mrglowurm
06-11-2003, 06:50 PM
You are 100% right - thanks for the advice - I'll do this from now on!

There's another thing I was hoping you might know what I'm doing wrong - I'm trying to capture the date field from the parent window, the fields are:

FirstSelectDay
FirstSelectMonth
FirstSelectYear

I've tried the following script but it's not working:

test.document.write('<tr><th align=left> Date:</th><td> ' + parent.document.Form1.FirstSelectDay.selected + '-' + parent.document.Form1.FirstSelectMonth.value + '-' + parent.document.Form1.FirstSelectYear.value + '</td></tr>')

Both "value" and "selected" or "now" don't work - how would I pull the selected date from the parent window?

Kind regards
Nick

jalarie
06-11-2003, 07:07 PM
First pick up the information something like the following lines, and then build your output line:

FSD_I=parent.document.Form1.FirstSelectDay.selectedIndex;
FSD_T=parent.document.Form1.FirstSelectDay.options[FSD_I].text;
FSM_I=parent.document.Form1.FirstSelectMonth.selectedIndex;
FSM_T=parent.document.Form1.FirstSelectMonth.options[FSM_I].text;
FSY_I=parent.document.Form1.FirstSelectYear.selectedIndex;
FSY_T=parent.document.Form1.FirstSelectYear.options[FSY_I].text;


Actually, I'd probably start with an abbreviation and then do the pickup:

FSD=parent.document.Form1.FirstSelectDay;
FSD_I=FSD.selectedIndex;
FSD_T=FSD.options[FSD_I].text;
FSM=parent.document.Form1.FirstSelectMonth;
FSM_I=FSM.selectedIndex;
FSM_T=FSM.options[FSM_I].text;
FSY=parent.document.Form1.FirstSelectYear;
FSY_I=FSY.selectedIndex;
FSY_T=FSY.options[FSY_I].text;

simongdawson
06-15-2003, 09:11 AM
My java scripts work in IE but not Netscape. I can however view the scripts in Netscape on their authors' pages, so the problem is not with my Netscape setup, but within my coding.

Could anyone with the time please look at http://www.the-limes.com in IE and then in Netscape and thern look at the source and see if they can suggest what I have done wrong?

Many thanks,

Simon

simongdawson
06-15-2003, 09:22 AM
I have just noticed that some Java scripts ARE working in Neyscape on my website. The ones that are not working are the ones which should produce stuff in the left hand margin of the page, the rest of the page being to the right of the 18% margin. I don't know if this will help someone sort me out?!

Simon

jalarie
06-16-2003, 03:32 PM
simongdawson, Netscape gives the following error messages:

JavaScript Error:
http://www.the-limes.com/java/menu_array.js, line 21:

missing ; before statement.

menunum=0;menus=new Array();_d=document;function addmenu(){menunum++;menus[menunum]=menu;}function dumpmenus(){mt="<scr"+"ipt language=JavaScript>";for(a=1;a<menus.length;a++){mt+=" menu"+a+"=menus["+a+"];"}mt+="<\/scr"+"ipt>";_d.write(mt)}
..........................................................................................^

JavaScript Error:
http://www.the-limes.com/java/menu_array_2.js, line 79:

dumpmenus is not defined.


The second error message is caused by the first. I think that the problem in the first is that Netscape does not recognize the '_d=document;' as valid.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum