Jump to content

GetElementById Compatibility


florynth

Recommended Posts

Hi,I'm doing a script that use the GetElementById function and I want to know with wich browser it's compatible.I do have a book (old one but...) who said for exemple to use document.all["id"] in IE 4.xBut anyway nobody use this anymore... So is there a current browser who's use that is not compatible with the function or I scratch my head for less then 1% of browser...Thanks for your answerMartin

Link to comment
Share on other sites

Don't use document.all. document.getElementById() is supported by every Javascript supporting browser released since 1998.source: some website

Link to comment
Share on other sites

Don't use document.all. document.getElementById() is supported by every Javascript supporting browser released since 1998.source: some website

Thanks ! So another question :I want to change the content of the element the code I did have before is
if(document.getElementById)  {    element = document.getElementById(Id); element.innerHTML = content;     } else if(document.layers)   {    element = document.layers[Id];element.document.open();    element.document.write(content);    element.document.close();      }

The second part was for Netscape. Since everything support getElementById do everything support also the innerHTML or I will have the do a browser detection instead?Just to let you know I'm creating a object in javascript to manage div that's not exactly the code I'll use but I don't need to show everything to have my answer... I'll post a message with the code when it will be ready to work and have some usefull function...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...