Fires when the user clicks the Stop button or leaves the Web page.
dhtml语法
Event property | document.onstop = handler | JScript only |
---|
document.onstop = GetRef("handler") | Visual Basic Scripting Edition (VBScript) 5.0 or later only |
Named script |
<SCRIPT FOR =
document EVENT = onstop>
| Internet Explorer only |
---|
Event Information
Bubbles | No |
---|
Cancels | No |
---|
To invoke | - Click the Stop button.
- Leave the Web page.
|
---|
Default action |
Initiates any action associated with this event. |
---|
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.
|
---|
shiftLeft |
Retrieves the state of the left SHIFT key.
|
---|
type |
Sets or retrieves the event name from the event object. |
---|
Remarks
The onstop event fires after the onbeforeunload event, and before the onunload event.
DHTML代码范例
This example uses the onstop event to stop a function from executing in a continuous cycle. The setinterval method is used to execute script every millisecond. if the user clicks the stop button, the clearinterval method removes the interval and the script is no longer executed.
document.onstop=fnTrapStop;
window.onload=fnInit;
var oInterval;
function fnInit(){
oInterval=window.setInterval("fnCycle()",1);
}
function fnCycle(){
// Do something
}
function fnTrapStop(){
window.clearInterval(oInterval);
}
是否符合公共标准
There is no public standard that applies to this event.
Applies To