onstop Event
Fires when the user clicks the Stop button or leaves the Web page.
Syntax
Inline HTML <ELEMENTonstop = "handler" ... > All platforms Event property object.onstop = handler JScript (compatible with ECMA 262 language specification) only Named script <SCRIPT FOR = object EVENT = onstop> Internet Explorer only
Remarks
Bubbles No Cancels No To invoke
- Click the Stop button.
- Leave the Web page.
Default action Initiates any action associated with this event. The onstop event fires after the onbeforeunload event, and before the onunload event.
Event Object Properties
Although event handlers in the document object model do not receive parameters directly, the handler can query the event object for data.
type Retrieves the event name from the event object.
Example
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.
Sample Code
document.onstop=fnTrapStop; window.onload=fnInit; var oInterval; function fnInit(){ oInterval=window.setInterval("fnCycle()",1); } function fnCycle(){ // Do something } function fnTrapStop(){ window.clearInterval(oInterval); }
Applies To
[ Object Name ] Platform Version Win16: Win32: Mac: Unix: WinCE: Version data is listed when the mouse hovers over a link, or the link has focus. document
Did you find this topic useful? Suggestions for other topics? write us!
© 1999 microsoft corporation. all rights reserved. terms of use.