Click to See Complete Forum and Search --> : Script doesn't work in Mozilla


JuB-jUb
10-11-2003, 05:27 PM
I have the following function:

function setHomeOn() {
document.cubes.src = homeOn.src;
document.all.btn_home.style.display="";
document.all.btn_bkgd.style.display="none";
document.all.btn_port.style.display="none";
document.all.btn_contact.style.display="none";
return true;
}

When I load it up in Mozilla/NS7, it doesn't work. I checked the JS Console and it says "document.all has no properties"...can anyone help?

Charles
10-11-2003, 05:30 PM
Don't worry about those few Mozilla users, worry about the greater number of MSIE users who do not use JavaScript. Simply make sure that your page works as well with as without JavaScript and all will be well.

pyro
10-11-2003, 06:35 PM
Take heed to what Charles said and you'll do well. Also, use the DOM document.getElementById rather than the IE document.all

Charles
10-11-2003, 06:42 PM
For Details of the DOM (DO{DOM}) see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/.

James L.
10-12-2003, 01:13 AM
I personally would worry about the Mozilla users, as there could potentially be millions of them out there.

I agree with the guys above, the best way to ensure your pages work in ALL current browsers (a goal that any professional web designer should have), is to code to the W3 standards.

Someone more in the know can correct me if I am wrong, but I believe document.all is a proprietary MicroSloth object that was introduced in IE 4. This was during the height of the browser wars between IE and NN when the two main companies were constantly adding features to THEIR browsers to try to out do the other browsers.

What this means is that IE is basically the only browser that will recognize document.all. It is NOT standard HTML/XHTML.

Charles
10-12-2003, 06:15 AM
The best way to ensure your pages work in ALL current browsers is to make sure that the page works as without JavaScript as with. And then it doesn't matter if your JavaScript only runs in MSIE.

James L.
10-12-2003, 12:33 PM
agreed.