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


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:

<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);
A:<input type="text" ID="tbA"/>
B:<input type="text" ID="tbB"/>
<input type="submit" ID="btnAdd" value="+" onclick="return fnAdd()"/>