Submit.onClick

JavaScript1.0+, JScript1.0+ Nav2+, IE3+, Opera3+ Syntax

onClick="command"

Description

The onClick event handler is fired when a submit button is clicked. Note that this is not fired in the instances where a single form object is in the form, such as a text box, and the user presses the Enter or Return key to submit the form.

Example

Listing 7.487 has a single text box and a button. If the user presses the submit button, the Click event is fired, calling a function that changes the text in the text box to all uppercase.

Listing 7.487 Using the onClick Event Handler to Verify a Form Before It Is Submitted
 <html> <head> <script language="JavaScript1.2"> <!-- Hide // Define the setText function to change the text to uppercase ...

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.