JavaScript Reference/Event Handlers Reference/onSubmit

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

"onSubmit" Example

   <source lang="javascript">
   

<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>


     </source>
   
  


"onSubmit" is applied to

   <source lang="javascript">

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

     </source>
   
  


"onSubmit" Properties

   <source lang="javascript">

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

     </source>
   
  


"onSubmit" Syntax and Note

   <source lang="javascript">

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.


     </source>