0

I'm testing something on an old version of netscape, specifically 4.7. Everythings fine except for my javscript function doesn't work because it says getElementById is not a function:

document.getElementById('ncp').src = "ncp" + pictureNum + ".jpg";


I've got many more of these type lines but it works fine in IE and FF. Is there something I can do to make this compatible with netscape browsers?

5
Contributors
5
Replies
6
Views
12 Years
Discussion Span
Last Post by agb_bbsr
0

You'll have to navigate the hierarchy. For example, use the document.images collection.

I made the decision long ago that I simply wasn't going to worry myself, or add huge development overhead, to supporting old browers, particularly for corporate development projects and/or sites. Use a strict DOCTYPE, code to that standard, cut down on the fancy stuff, and use server-side code as much as possible.

0

I just decided to scrap the idea. I couldn't get anything to work without changing a bunch of code. I think to really get it to work you have to use layers with netscape, but it's just not worth it.

Thanks for the help!

0

Netscape 6+ supports getElementById.
If you require support for Netscape 4 (about 1 visitor in 500 or less now) then you need to use document.layers instead just for those visitors and use getElementById for everyone else.

0

document.getElementById("supplier_no").value = values_array[0];

java script: some times i get error as getElementById is invalid function or returns null. It works perfect in IE but not in Firefox. what is the reason...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.