onstop

HTML (DHTML)

onstop Event

Internet Development Index

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

Syntax

Event propertydocument.onstop = handlerJScript 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

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

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.

document.onstop=fnTrapStop;
window.onload=fnInit;
var oInterval;
function fnInit(){
oInterval=window.setInterval("fnCycle()",1);
}
function fnCycle(){
// Do something
}
function fnTrapStop(){
window.clearInterval(oInterval);
}

Standards Information

There is no public standard that applies to this event.

Applies To

document