getElementById function used for accessing a specific dom node using an element id.

Syntax:

getElementById('elementid'); Once you get dom node reference, using the referencing variable you can read values present in each property of don node very easily.

Example for getElementById:

<html>
<head>
<title>GetElementById Example</title>
<script language="javascript" type="text/javascript">
function fnAdd()
{
     
     var tba=document.getElementById("tba");
     var tbb=document.getElementById("tbb");
     var op=parseInt(tba.value) +parseInt(tbb.value);
     alert(op);
} 
</script>
</head>
<body>
A:<input type="text" ID="tbA"/>
B:<input type="text" ID="tbB"/>
<br/>
<input type="submit" ID="btnAdd" value="+" onclick="return fnAdd()"/>
</body>
</html>