w3schools    w3Schools
Search :
   
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About
ADVERTISEMENTS

XML Certification
Download XML editor
Custom Programming
 
Table of contents
HTML DOM
DOM HOME
DOM Intro
DOM Nodes
DOM Node Tree
DOM Methods
DOM Node Access
DOM Node Info
DOM How To
DOM Events
DOM Reference
DOM Summary

DOM Examples
DOM Examples

DOM Objects
DOM Window
DOM Navigator
DOM Screen
DOM History
DOM Location

DOM Document

DOM Anchor
DOM Area
DOM Base
DOM Body
DOM Button
DOM Event
DOM Form
DOM Frame
DOM Frameset
DOM IFrame
DOM Image
DOM Input Button
DOM Input Checkbox
DOM Input File
DOM Input Hidden
DOM Input Password
DOM Input Radio
DOM Input Reset
DOM Input Submit
DOM Input Text
DOM Link
DOM Meta
DOM Object
DOM Option
DOM Select
DOM Style
DOM Table
DOM TableCell
DOM TableRow
DOM Textarea

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

Browse Tutorials
 

onreset Event


Event Object Reference Complete Event Object Reference

Definition and Usage

The onreset event occurs when the reset button in a form is clicked.

Syntax

onreset="SomeJavaScriptCode"

Parameter Description
SomeJavaScriptCode Required. Specifies a JavaScript to be executed when the event occurs.

Supported by the following HTML tags:

<form>

Supported by the following JavaScript objects:

form


Example

In this example the form changes back to the default values and displays an alert box when the reset button is clicked:

<form onreset="alert('The form will be reset')">
Firstname: <input type="text" name="fname" value="John" />
<br />
Lastname: <input type="text" name="lname" />
<br /><br />
<input type="reset" value="Reset">
</form>

The output of the code above will be:

Firstname:
Lastname:



Try-It-Yourself Demos

onreset
How to use onreset to display an alert when a reset event occurs.


Event Object Reference Complete Event Object Reference