HTML and CSS Reference
EXPLANATION ( CONTINUED )
The HTML input type is a text field named your_name , which will display up to
The HTML input type is a submit button. When the user clicks this button, the
onSubmit handler in line 4 is triggered. If the return value from the function
check_Form is true , the form will be submitted to the server, located at the URL
shown in the action attribute of the form named info .
Using the button Input Type Rather than submit . As shown in the previous
examples, before the browser sends data to the server, an onSubmit or onClick event han-
dler is triggered when the user clicks the submit button or presses the Enter key. But
what if you don't want the form to go off to the server? Then you will have to reject the
submission or the browser will reset all the field values to their defaults.
If the form is not going to submit data to a server, the button input type can be used
instead of the submit button. The button object has no default behavior and is used as a
triggering device so that when the user clicks the button, it causes something to happen.
The onClick event handler is commonly used with buttons and is set as an attribute of
the button input type. The onClick event handler is triggered when the user clicks the
button associated with it.
<head><title>button input type</title>
alert("Why did you click me like that? ");
<!-- event handler for a button is an attribute for its
input type -->
This function called greetme() is called when the user clicks the button device.
A form called form1 is started.