PDA

Click to See Complete Forum and Search --> : [Javascript] - getElementById is not a function


System_Error
Sep 24th, 2005, 05:45 PM
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?

CornedBee
Sep 25th, 2005, 09:10 AM
No. Netscape prior to the Mozilla project doesn't support getElementById. You have to use document.images['name'] to access images. However, note that this method only finds images if the name attribute is set, and won't find them by their id attribute. (I might be wrong about that last one, but I don't think so.)