Click to return to the DHTML, HTML     
refresh Method     reload Method     DHTML Methods    
Web Workshop  |  DHTML, HTML & CSS

releaseCapture Method


Removes mouse capture from the object in the current document.

Syntax

object.releaseCapture()

Return Value

No return value.

Remarks

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.

Example

This example invokes the releaseCapture method on the document object.

Sample Code

<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>

This feature requires Microsoft® Internet Explorer 5 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
A, ADDRESS, APPLET, AREA, B, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, custom, DD, DFN, DIR, DIV, DL, document, DT, EM, EMBED, FIELDSET, FONT, FORM, Hn, HR, I, IMG, INPUT type=submit, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=text, 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

See Also

Mouse Capture Overview, onlosecapture, setCapture



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.