The HTML Attribute reference

"onreset" - html Event

  • The onreset event occurs when a form is reset.

Value(s): One or more script statements each ended with a semicolon.

Event "onreset" example:
<html>
  <body>
    <form name="carform" action="tryexamples/getFerrari.php"
       onsubmit="if (document.carform.car.value!='Ferrari')
            { alert('This is not a Ferrari!'); return false;}"
      onreset="document.carform.car.value='Ferrari'; return false;">
      <fieldset>
        <legend>Buy a Car:</legend>
        Type : <input type="text" name="car" value="Volvo" /><br />
        Model: <input type="text" name="model" value="2010"/><br />
        Price : <input type="text" name="price" value="$100000"/>
      </fieldset>
      <button type="submit" >Get Ferrari</button>
      <button type="reset" >Reset form</button>
    </form>
  </body>
</html>
Used in the element(s):
Elements Description
form This element defines an interactive form.

© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.