How to Accessing Elements using javascript?
The elements of JavaScript are accessed by their names. By default the browser is accessed by the element ‘windows’ and the page by ‘document’. The corresponding element has user defined names for forms and its elements.
For example var passwd = windows.document.frmLogin.password.value;
assigns the value of the password field of the form fromLogin in the current document, where password is the name of the element and frmLogin is the name of the form. Like wise any form element is accessed.
How to Accessing Elements using javascript?
Following are some of the functions with which the elements can be retrieved:
- getElementById()
- getElementByName()
- getElementByValue()
- getElementByTag()