• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

The form Object

The HTML form object is the primary way for Web pages to solicit different types of input from the user. JavaScript will often work along with HTML forms to perform its functions. The object model for HTML forms includes a wide variety of properties, methods, and events. If you use these with each form, JavaScript can manipulate and access those forms.

form Object Properties

Tables 19.4, 19.5, and 19.6 show some of the properties, methods, and events attached to HTML form objects. These can be used in JavaScripts—the properties and methods can be used to access or manipulate information and to perform certain functions, and the events can be used to trigger JavaScript functions related to the form itself. If a form is named Form1, for instance, the method document.Form1.submit() can be called in JavaScript to submit the form. On the other hand, if the Submit button calls a function in response to an onSubmit event, the submission of the form can be disabled if the function returns a false value. This is a good way to perform form validation within the Web browser and to allow submission of the form only if all fields are validated.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint