losecapture | onlosecapture event
Fires when the object loses the mouse capture.
Syntax
| HTML Attribute | <element onlosecapture = "handler(event)"> |
|---|---|
| Event Property | object.onlosecapture = handler; |
| attachEvent Method | object.attachEvent("onlosecapture", handler) |
| addEventListener Method | object.addEventListener("losecapture", handler, useCapture) |
Event information
| Synchronous | No |
|---|---|
| Bubbles | No |
| Cancelable | No |
Event handler parameters
- pEvtObj [in]
-
Type: IHTMLEventObj
Standards information
There are no standards that apply here.
Remarks
Sends the event notification to the object that is losing the mouse capture.
To invoke this event, do one of the following:
- Set mouse capture to a different object.
- Change the active window so that the current document using mouse capture loses focus.
- Invoke the releaseCapture method on the document or object.
The pEvtObj parameter is required for the following interfaces:
- HTMLAnchorEvents2
- HTMLAreaEvents2
- HTMLButtonElementEvents2
- HTMLControlElementEvents2
- HTMLDocumentEvents2
- HTMLElementEvents2
- HTMLFormElementEvents2
- HTMLImgEvents2
- HTMLFrameSiteEvents2
- HTMLInputFileElementEvents2
- HTMLInputImageEvents2
- HTMLInputTextElementEvents2
- HTMLLabelEvents2
- HTMLLinkElementEvents2
- HTMLMapEvents2
- HTMLMarqueeElementEvents2
- HTMLObjectElementEvents2
- HTMLOptionButtonElementEvents2
- HTMLScriptEvents2
- HTMLSelectElementEvents2
- HTMLStyleElementEvents2
- HTMLTableEvents2
- HTMLTextContainerEvents2
- HTMLWindowEvents2
Examples
This example shows how to fire the onlosecapture event. When the user clicks the mouse, the releaseCapture method is invoked and subsequently fires the onlosecapture event.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onlosecaptureEX.htm
<!DOCTYPE html>
<html>
<head>
<title>Example of the onlosecapture Event on an Object</title>
<style>
#divOwnCapture {
height: 275px;
width: 400px;
background-color: gray;
font-family: sans-serif;
font-size: 12pt;
}
#divNoCapture {
height: 275px;
width: 400px;
background-color: white;
font-family: sans-serif;
font-size: 12pt;
}
</style>
</head>
<body onload="divOwnCapture.setCapture()" onclick="divOwnCapture.releaseCapture()">
<div id="divOwnCapture"
onmousemove="txtWriteLocation.value=event.clientX + event.clientY"
onlosecapture="alert(event.srcElement.id + ' lost mouse capture.')">
<p>
Mouse capture has been set to this gray division (DIV) at
load time using the <strong>setCapture</strong> method. The text area will track
the <strong>mousemove</strong> event anywhere in the document.
</p>
<textarea id="txtWriteLocation" cols="2"></textarea>
</div>
</body>
</html>
See also
- a
- address
- applet
- area
- b
- bdo
- big
- blockQuote
- body
- br
- button
- caption
- center
- cite
- code
- custom
- dd
- dfn
- dir
- div
- dl
- dt
- em
- embed
- fieldSet
- font
- form
- hn
- hr
- i
- img
- input type=button
- input type=checkbox
- input type=email
- input type=file
- input type=hidden
- input type=image
- input type=number
- input type=password
- input type=radio
- input type=range
- input type=reset
- input type=search
- input type=submit
- input type=tel
- input type=text
- input type=url
- kbd
- label
- legend
- li
- listing
- map
- marquee
- menu
- noBR
- object
- ol
- option
- p
- plainText
- pre
- s
- samp
- select
- small
- span
- strike
- strong
- sub
- sup
- table
- tBody
- td
- textArea
- tFoot
- th
- tHead
- tr
- tt
- u
- ul
- var
- xmp
- Reference
- releaseCapture
- setCapture
- msSetPointerCapture
- msReleasePointerCapture
- Conceptual
- About Mouse Capture