document.all() - is a non-standard way of accessing DOM elements. It was introduced in Internet Explorer 4, because the W3C DOM hadn’t yet standardised a way of grabbing references to elements using their ID. By the time IE 5 came out, document.getElementById() had been standardised and as a result, IE 5 included support for it.
document.getElementById() - is a standard and fully supported. Each element have a unique id on the document. It is supported by every Javascript supporting browser released since 1998.
Or you can use:
JavaScript
if(document.getElementById){ //DOM
element = document.getElementById(id);
}
else if (document.all) { //IE
element = document.all[id];
}
else if (document.layers){ //Netscape < 6
element = document.layers[id];
}





why use document.getElementById ?????
you can use $(“someid”) as in jquery and mootools
@Sreejith Sreedharan: You can use $() function instead of this, if you are using any Js framework in your web-application.