PDA

View Full Version : getElement for NS/IE


rlemon
04-05-2005, 04:15 PM
function getElement(aID){
var rv = (document.getElementById) ? document.getElementById(aID) :
document.all[aID];
return rv;
}


This script should return the element in both IE and NS without problems.

Use Example:

var myElement = getElement('someE');

Notice how I can now make one single call for both IE and NS?
ohh well, hope this helps!

Mr J
04-05-2005, 08:12 PM
document.getElementById is recognised by IE and NS so you need to be more specific as to which versions actually support it.