onstop Event

MS Office DHTML, HTML & CSS

 
Click to return to the DHTML, HTML & CSS home page    
onstart Event     onsubmit Event     DHTML Events    

onstop Event


Fires when the user clicks the Stop button or leaves the Web page.

Syntax

Inline HTML <ELEMENTonstop = "handler" ... >All platforms
Event propertyobject.onstop = handlerJScript (compatible with ECMA 262 language specification) only
Named script<SCRIPT FOR = object EVENT = onstop>Internet Explorer only

Remarks

BubblesNo
CancelsNo
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.

Event Object Properties

typeRetrieves 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 ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
document

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.