How to Access Document Objects Through JavaScript

Let’ have a look towards the example:

<title>Accesing document objects</title>
<script type="text/javascript">
function displayvalue()
var address=document.form.address.value;
<form name="form">
Name:<input type="text" name="name"/></br>
Address:<input type="text" address="address"/></br>
<input type="button" onsubmit="displayvalue()" value="Display name"/>
<input type="button" onsubmit="displayvalue()" value="Display Address"/>


 The logic applied in the above example is;

Here, document is the root of the html document, form is the name of the form from where the function displayvalue() will display the name entered by the user, name is the attribute name of the input text and value is the property that returns the value of input text.