Previous Example-|-Next Example-|-Return to Chapter Listing

Example 12.16:
onreset: When the User Clicks Reset

[This example works with Netscape Navigator 3. It will not work with Internet Explorer 3.]

The onreset event handler is used to carry out an action when the user clicks the Reset button. You can simply click the button and you'll see the message. Or change the text before you click the button; you'll see the text return to the original text after you click OK.

There's no way to stop a reset action once the user clicks the Reset button, though you could create a fake Reset button; see the following example.


In the BODY of the page we have this form: <form onreset="alert('The form has been cleared and returned to its original state.')"> <input type="text" value="Here's the text" size="20"> <input type="reset">
Previous Example-|-Next Example-|-Return to Chapter Listing