JavaScript Reference/Event Handlers Reference/onSubmit

Материал из Web эксперт
Перейти к: навигация, поиск

"onSubmit" Example

    
<html>
<body>
<form name="form1" 
      method="post" 
      action="" 
      onsubmit="alert("The form is being submitted")">
   <input type="text" name="textfield">
   <input type="submit" value="Submit">
</form>
</body>
</html>



"onSubmit" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<form>                                                        |
+----------------+--------------------------------------------------------------+



"onSubmit" Properties

+----------------+--------------------------------------------------------------+
| Properties     |altKey                          altLeft                       |
|                |ctrlKey                         ctrlLeft                      |
|                |returnValue                     shiftLeft                     |
|                |srcElement                      type                          |
+----------------+--------------------------------------------------------------+



"onSubmit" Syntax and Note

Note:
    
This event fires when the user submits a form or clicking a Submit button.
This event is in response to the form.submit() method.
Use this action to validate data on the client side.