HTML Command Button Control

  • The comand button control is used to initiate a particular action . The <input> tag is again used for creating the command button .
  • The type attribute for <input> tag can take the following values:
  • Type Description
    submit submit button will pass the data of all input elements to the file defined in action attribute.
    reset reset button creates a button that automatically resets form controls to their initial values.
    button This creates a button that is used to trigger a client-side script when the user clicks that button.
    image This creates a clickable button but we can use an image as background of the button.


  • Here is an example of command buttons:

Example

<!DOCTYPE html>
<html>
<body>
<form >
<input type="submit" name="submit" value="Submit" /><br>
<input type="reset" name="reset" value="Reset" /><br>
<input type="button" name="ok" value="OK" /><br>
<input type="image" name="imagebutton" src="html_tut.jpg" /><br>
</form>
</body>
</html>


To see live output : Visit Try Yourself Editor

Output