JavaScript Button Object

The JavaScript Button object is a property of the form object. Button FORM syntax is:

<INPUT TYPE="button" NAME="myButton" VALUE="Press This" onClick="clickFunction">

Here's how it looks:


The type may be one of "button", "submit", or "reset". The name is the name you want to call the button. The onclick and associated function is optional. The clickFunction is run when the button is clicked and must exist, usually in the header.

Properties

  • form - The form object that includes the button.
  • name - The name of the button.
  • type - The type of element which is button, submit, or reset.
  • value - The value of the button that appears on the button.

Methods

  • blur() - Takes the focus away from the radio button.
  • click() - This function acts as if the user clicked the button.
  • focus() - Gives the focus to the checkbox.

Events

  • onBlur
  • onClick
  • onFocus