AvailabilityJavaScript 1.0; enhanced in JavaScript 1.1 Inherits from/OverridesInherits from Input, HTMLElement Synopsisform.name form.elements[i] PropertiesReset inherits properties from Input and HTMLElement and defines or overrides the following:
MethodsReset inherits the methods of Input and HTMLElement. Event HandlersReset inherits the event handlers of Input and HTMLElement and defines or overrides the following:
HTML SyntaxA Reset element is created with a standard HTML <input> tag: <form> ... <input type="reset" // Specifies that this is a Reset button [ value="label" ] // The text that is to appear within the button // Specifies the value property [ name="name" ] // A name you can use later to refer to the button // Specifies the name property [ onclick="handler" ] // JavaScript statements to be executed when the button // is clicked > ... </form> Reset objects can also be created with the HTML 4 <button> tag: <button id="name" type="reset" onclick="handler"> label </button> DescriptionThe Reset element has the same properties and methods as the Button element but has a more specialized purpose. When a Reset element is clicked, the values of all input elements in the form that contains it are reset to their initial default values. (For most elements, this means to the value specified by the HTML value attribute.) If no initial value was specified, a click on the Reset button clears any user input from those elements. UsageIf no value attribute is specified for a Reset element, it is labeled "Reset". In some forms, it may be better to label the button "Clear Form" or "Defaults". In JavaScript 1.1, you can simulate the action of a Reset button with the reset( ) method of the Form object. Also in JavaScript 1.1, the onreset event handler of the Form object is invoked before the form is reset. This event handler can cancel the reset by returning false. See AlsoButton, Form, HTMLElement, Input; HTMLInputElement in the DOM reference section |