Form.onSubmit

JavaScript 1.0+, JScript 1.0+ Nav2+, IE 3+, Opera3+ Syntax

onSubmit="command"

Description

The onSubmit method of the Form property executes JavaScript code when a submit event occurs.

Example

Listing 7.264 shows how the onSubmit event handler is used for a Form object. A user would enter his or her comments in the text area provided. Once done, he or she clicks the Submit button to submit the form. Using the onSubmit event handler, you can display a thank you note when the user has submitted his or her comments.

Listing 7.264 Using the onSubmit() Form Method
 <html> <head> <title> Using the onSubmit event handler for the Form object</title> </head> <body> <script language="JavaScript"> <!-- Hide //function displays a confirmation ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.