getElementById is not a function
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?
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
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.
tgreer
Made Her Cry
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
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!
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
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.
felgall
Junior Poster in Training
50 posts since Aug 2004
Reputation Points: 13
Solved Threads: 1