943,763 Members | Top Members by Rank

Ad:
Sep 24th, 2005
0

getElementById is not a function

Expand Post »
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?
Similar Threads
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Sep 26th, 2005
0

Re: getElementById is not a function

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.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Sep 27th, 2005
0

Re: getElementById is not a function

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!
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Sep 29th, 2005
0

Re: getElementById is not a function

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.
Reputation Points: 13
Solved Threads: 1
Junior Poster in Training
felgall is offline Offline
50 posts
since Aug 2004
Sep 29th, 2005
0

Re: getElementById is not a function

Yeah, the layers is the only way in netscape.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shephunts is offline Offline
5 posts
since Sep 2005
Apr 30th, 2010
0

document.getElementById

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...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
agb_bbsr is offline Offline
1 posts
since Apr 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: IE. FF Css menu
Next Thread in HTML and CSS Forum Timeline: html editors





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC