por curiosidad, ¿de donde lo has sacado? el ejemplo obtenido de
http://www.w3schools.com/jsref/met_d...lementbyid.asp
Código:
<html>
<head>
<script type="text/javascript">
function getValue()
{
var x=document.getElementById("myHeader")
alert(x.innerHTML)
}
</script>
</head>
<body>
<h1 id="myHeader" onclick="getValue()">This is a header</h1>
<p>Click on the header to alert its value</p>
</body>
</html>
getElementById devuelve un objeto, siendo este una referencia al elemento con dicho ID.