www.fgks.org   »   [go: up one dir, main page]

Click to Rate and Give Feedback
 onreset Event
onreset Event

Fires when the user resets a form.

Syntax

Inline HTML<FORM onreset = "handler" ... > All platforms
Event propertyFORM.onreset = handlerJScript only
FORM.onreset = GetRef("handler")Visual Basic Scripting Edition (VBScript) 5.0 or later only
Named script <SCRIPT FOR = FORM EVENT = onreset> Internet Explorer only

Event Information

BubblesNo
CancelsYes
To invoke
Default action Executes associated code.

Event Object Properties

Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query the event object for the following event properties.

Available Properties

altKey Sets or retrieves a value that indicates the state of the ALT key.
altLeft Sets or retrieves a value that indicates the state of the left ALT key.
ctrlLeft Sets or retrieves the state of the left CTRL key.
returnValue Sets or retrieves the return value from the event.
shiftLeft Retrieves the state of the left SHIFT key.
srcElement Sets or retrieves the object that fired the event.
type Sets or retrieves the event name from the event object.

Example

This example demonstrates how to use the onreset event for a form object. Reset the form by clicking the first or second button. The only difference between the two buttons is that the second button invokes the reset method of the form object and the first button is of input type=reset. When either 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>
function doReset(){
    oTextArea1.innerText += "Resetting form.  ";
}
</SCRIPT>
</HEAD>

<BODY>
<FORM name="form1" 
    <B>Form</B><BR>
    style="border:2px solid #cccccc; background:#EEEEEE; padding:10px; ">
    <b>Enter some text:</b>
    <INPUT type="text" name="oText1" value=""><BR><BR>
    <INPUT TYPE="reset" value="Input type=reset"/>
    <BUTTON >form.reset()</BUTTON>
</FORM>

<B>Form status</B><BR>
<SPAN id="oTextArea1" ></SPAN>
<BR><BR>
<BUTTON >Refresh Page</BUTTON>
</BODY>
</HTML>
This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

This event is defined in HTML 4.0 World Wide Web link.

Applies To

FORM

See Also

reset
Tags What's this?: Add a tag
Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker
DCSIMG