Possible Duplicate:
IE/Chrome: are DOM tree elements global variables here?
I recently discovered that I can use in javascript any object from DOM with a direct reference to its id:
<div id="layer">IM A LAYER</div>
<script>
alert(layer.innerHTML);
</script>
If this is true, what advantage I'd get using the getElementById method?