Forms and javascript

One of the really useful things we can do with javascript involves html forms.

One use for this is to check that the user has entered valid information on the form before sending it to the server.

This is called Form Validation

Before we can validate form data we need to know how to access the various form elements.

With javascript we can access the values of all the form elements.

The general syntax using the Dom level 0 method and following the object hierarchy is

window.document.forms[0].elements[0].value

We will start by using this to access the value in a Text Box