Click to See Complete Forum and Search --> : Is Nescape 4 Buggy With Javascript?


andrewkooi
02-05-2003, 11:11 PM
Greetings,

Based on the suggested code obtained from my previous posting (Question: Calculation Problem), I added the code into my website. When I loaded the website on IE, it worked fine but when I loaded the website on Netscape 4.75, I kept on getting this message:

Invalid Page Fault in module JS3240.dll

Just wondering whether this has got to do with a problem with Nescape 4.75...


Regards,

Andrew

khalidali63
02-05-2003, 11:33 PM
My bet is that the code you have got is not standard compliant.Because anythiing that works in IE and does not work in NS it most likely means that code has IE specific elements values.

cheers

Khalid

andrewkooi
02-06-2003, 12:14 AM
What you mentioned may be right but the strange thing is, Netscape 6 opens the same website with no problems at all. How about that?

khalidali63
02-06-2003, 12:50 AM
That is because netscape 6+ has adopted some of the IE specific elements in its JavaScript engine because of the great demand by developers( IE is more then 90% of desktop pc market share).But that does not mean that IE is a standard compliant browser.
Even at this time NS6+ browsers is the most standards complinat browsers out there.IE is trying to do that but it will take a great deal of work for IE developers,since they are used to write
wrong code and IE fixes it without them knowing.

I think for learning purposes NS must be the browser of choice,since it does not forgive coding errors and hence forcing the writer to learn more standrardized coding practices.

cheers

Khalid

andrewkooi
02-06-2003, 01:55 AM
Greetings,

Looks like there must be something wrong with the javascript code I am using which causes Netscape 4.75 to crash so drastically. Below is the code I am using (partly from Dreamweaver 3.0):


<script language="JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>


onmouseout="MM_swapImgRestore()" onmouseover="switch (new Date().getFullYear() % 3) {case 0 :
MM_swapImage('oldimage','','images/newimage.jpg',1); break; case 1 :
MM_swapImage('oldimage','','images/newimage.jpg',1); break; case 2:
MM_swapImage('oldimage','','images/newimage.jpg',1); break; default:
MM_swapImage('oldimage','','images/newimage.jpg',1);};return document.MM_returnValue">

Just wondering where I went wrong, for when I remove this code, my website works without a hitch.

FYI... my website which is causing such problems to Netscape 4.75 is:

Andrew's Responsorial Psalms (http://www.angelfire.com/folk/holyweekpsalms)

Thanx in advance for replies.


Regards,

:confused: Andrew

Charles
02-06-2003, 04:32 AM
I don't see anything there that might be giving Netscape 4 pause, except that Netscape is known to behave in non-standard ways if you use the LANGUAGE attribute with the SCRIPT element. Use instead:

<script type="text/javascript">

But I don' think that that's the problem; JavaScript does not throw errors like "Invalid Page Fault in module JS3240.dll". That looks like Netscape falling apart. You might want to try your page on somebody else's instance of Netscape 4.

gil davis
02-06-2003, 06:27 AM
Originally posted by Charles
Netscape is known to behave in non-standard ways if you use the LANGUAGE attribute with the SCRIPT element. Use instead:

<script type="text/javascript">
Netscape 4 does not support the "type" attribute for the <SCRIPT> tag. When you use that syntax, NS 4 will default to JavaScript1.3 syntax - it's default - which is probably ok. The only reason you would have to use the LANGUAGE="..." part of the tag is to force NS 4 to use one of the older versions of javascript for compatibility with an older browser. Netscape will ignore a script tag with a language that is not part of it's repertoire (unlike IE which tries to figure it out anyway) - for example, if NS 3 saw a tag with LANGUAGE="JavaScript1.3" in it, that script would be ignored.

As to the *real* problem - NS 4.75 and 4.78 are probably the worst of the latest revisions out there. I have been running 4.8 without much trouble for some time now. I suggest you give up on 4.75 and get 4.8 - oh, yeah, and tell your friends.

Charles
02-06-2003, 09:33 AM
Try running the following with Netscape.

<script language="JavaScript">
<!--
alert(['fee', 'fie', 'foe', 'fum']);
// -->
</script>

<script type="text/javascript">
<!--
alert(['fee', 'fie', 'foe', 'fum']);
// -->
</script>

gil davis
02-06-2003, 09:58 AM
Originally posted by Charles
Try running the following with Netscape.
What version of Netscape? If you run your test in NS 2, then you will get an error on *both* lines of code.

If you specify language="JavaScript", that puts NS into JavaScript 1.0 mode, which does not support creating arrays inline. If you don't specify language="...", then you get a default language.

NS 2 = JavaScript 1.0 (language="JavaScript")
NS 3 = JavaScript 1.1 (language="JavaScript1.1")
NS 4 = JavaScript 1.2 (language="JavaScript1.2")
NS 4.5 = JavaScript 1.3 (language="JavaScript1.3")
NS 5 = JavaScript 1.4 (language="JavaScript1.4")
NS 6 = JavaScript 1.5 (language="JavaScript1.5")

Starting with JS 1.3, they became compliant with ECMA-262. See http://developer.netscape.com/docs/manuals/js/client/jsguide/whatsnew.htm for details. The other differences are dispersed throughout their JS 1.3 manual.

The ARRAY behaviour you demonstrate is well documented. See http://developer.netscape.com/docs/manuals/js/client/jsref/array.htm#1193137 for details.