| home / programming / javascript / beginning / chap6 / 2 |
[previous] [next] |
|
HTML Elements in FormsButton Form ElementsI'm starting our look at form elements with the standard button element, as it's probably the most commonly used and is fairly simple. The HTML tag to create a button is the <INPUT> tag. For example, to create a button called myButton, which has the words Click Me on its face, the <INPUT> tag would need to be: The TYPE attribute is set to button and the VALUE attribute is set to the text we want to appear on the face of the button. We can leave the VALUE attribute off, but we'll end up with a blank button, which will leave our users guessing as to its purpose. This element creates an associated Button object; in this example it is called myButton. This object has all the common properties and methods described above, including the value property. This allows you to change the text on the button face using JavaScript, though this is probably not something you'll need to do very often. What the button is really all about is the onclick event. |
| home / programming / javascript / beginning / chap6 / 2 |
[previous] [next] |
Created: January 29, 2001
Revised: January 29, 2001