Fires when the user resets a form.
dhtml语法
Inline HTML | <FORM
onreset = "handler" ... >
| All platforms |
---|
Event property | FORM.onreset = handler | JScript 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
Bubbles | No |
---|
Cancels | Yes |
---|
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 an event object for data.
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. |
---|
DHTML代码范例
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" onreset="doReset();"
<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 onclick="form.reset();">form.reset()</BUTTON>
</FORM>
<B>Form status</B><BR>
<SPAN id="oTextArea1" ></SPAN>
<BR><BR>
<BUTTON onclick="location.reload(true);">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.
是否符合公共标准
This event is defined in
HTML 4.0 .
Applies To
更多语法参考
reset