Changes

Jump to: navigation, search

Building Forms with JavaScript

300 bytes added, 19:27, 16 May 2007
The JavaScript Button Object
Next to the Text object the JavaScript Button object is probably the second most commonly used GUI componenent when developing JavaScript forms. There are three types of Button object available. As with the Text object the Button objects use the <input> tag. The ''type='' attribute ius then used to define which type of button is to be created. The three different types are:
* '''type="BUTTON"''' - The basic button which performs no action by default unless an event handler is assigned to it.
* '''type="SUBMIT"''' - The submit button. When pressed this button causes the data in the Form to sent to the server using the settings defined in the enclosing <Form> tag.
* '''type="RESET"''' - The reset button. When pressed causes the fields in the Form to be either cleared, or reset to the defaultValue (if one has been specified). A submit button can be created as follows: <pre> <form <input type="SUBMIT" name="buttonName" value="Click here to submit information"> </pre> The generic "BUTTON" type can be defined as follows (whereby an event handler is set up to call a function when the button is pressed:

Navigation menu