EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

reset method

Simulates a mouse click on a reset button for the calling form.

Document Object Model (DOM) Level 2 HTML Specification, Section 1.6.5

Syntax

var retval = form.reset();

Parameters

This method has no parameters.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Standards information

Remarks

The reset method fires the onreset event on the form.

Examples

This example demonstrates how to use the reset method for a form object. When the button is pressed, the form is reset, resulting in the onreset event call on the form object. The onreset event calls an event handler which in turn adds the text Resetting form. to the text area below.


<html>

<head>
<script type="text/javascript">
function doReset(){
    oTextArea1.value += "Resetting form.  ";
}
</script>
</head>

<body>

<div id="oDiv1" style="border: 1px solid black; background: #EEEEEE; padding: 10px;">
  <b>Form</b>
  <form name="form1" onreset="doReset();">
	<b>Enter some text:</b> <input name="oText1" type="text" value=""><br/><br/>
	<button onclick="form.reset();">form.reset()</button>
  </form>
</div>
<b>Text area</b><br><textarea id="oTextArea1" cols="75" rows="5" value=""></textarea>

</body>

</html>



See also

form

 

 

Mostrar:
© 2014 Microsoft