Home | Top | Website design | JavaScript Editor | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |
Sets the mouse capture to the object belonging to the current document.
Syntax
object.setCapture( [ bContainerCapture ] )Parameters
bContainerCapture | Optional. Boolean that specifies one of the following values:
|
Return Value
No return value.
Remarks
Once mouse capture is set to an object, that object fires all mouse events for the document. Supported mouse events include onmousedown , onmouseup , onmousemove , onclick , ondblclick , onmouseover , and onmouseout . The srcElement property of the window event object always returns the object that is positioned under the mouse rather than the object that has mouse capture.
When a container object, such as a div , has mouse capture, events originating on objects within that container are fired by the div , unless the bContainerCapture parameter of the setCapture method is set to false . Passing the value false causes the container to no longer capture all document events. Instead, objects within that container still fire events, and those events also bubble as expected.
Drag-and-drop as well as text selection through the user interface are disabled when mouse capture is set programmatically.
The following key events are unaffected by mouse capture and fire as usual: onkeydown , onkeyup , and onkeypress .
The bContainerCapture is available only in Microsoft® Internet Explorer 5.5 or later. For earlier versions, do not specify a parameter.
Examples
The following examples use the setCapture method to show different aspects of mouse capture.This example shows the difference between detecting events using event bubbling and mouse capture.
<BODY onload="oOwnCapture. setCapture ()" onclick="document.releaseCapture()">
This example shows how to use mouse capture to animate graphics.
<HEAD>
Standards Information
There is no public standard that applies to this method.
Applies To
|
A , ADDRESS , APPLET , AREA , B , 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=file , INPUT type=hidden , INPUT type=image , INPUT type=password , INPUT type=radio , INPUT type=reset , INPUT type=submit , 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 |
Home | Top | Website design | JavaScript Editor | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |