This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

releaseCapture

Summary

Removes mouse capture from the object in the current document.

Method of dom/Documentdom/Document

Syntax

 document.releaseCapture();

Return Value

No return value

Examples

This example invokes the releaseCapture method on the document object.

<!doctype html>
<html>
 <head>
  <title></title>
 </head>
 <body onload="oOwnCapture.setCapture();"
    onclick="document.releaseCapture();">
  <div id="oOwnCapture"
    onmousemove="oWriteLocation.value =
        event.clientX + event.clientY";
    onlosecapture="alert(event.srcElement.id +
        ' has lost mouse capture.')">
  <textarea id="oWriteLocation" cols="2"></textarea>
  </div>
  <hr/>
  <div id=oNoCapture>
   <p>Click the document to invoke the releaseCapture method.</p>
  </div>
 </body>
</html>

View live example

Notes

  • For releaseCapture to have an effect, you must set mouse capture through the setCapture method.
  • You can invoke the releaseCapture method on the Document object.
  • The releaseCapture method makes it unnecessary to determine which element has capture to programmatically release it.
  • Other actions that release document capture include displaying a modal dialog box and switching focus to another application or browser window.

Attributions