JavaScript Reference/Javascript Methods/setCapture

Материал из Web эксперт
Перейти к: навигация, поиск

"setCapture()" Example

   <source lang="javascript">
   

<html> <body> <script language="JavaScript"> function function3() {

  myX.innerHTML = window.event.offsetX;
  myY.innerHTML = window.event.offsetY; 

} function function1() {

  myDiv.setCapture();

} function function2() {

  myDiv.releaseCapture();

} </script>

X Coordinate: 0

Y Coordinate: 0

    Click inside the box to disable mouse capture outside the box

<button onclick="function1()">Set capture</button> </body> </html>


     </source>
   
  


"setCapture()" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<a> <address> | | |<applet> <area> | | | |

| |
<body> |

| |
<button> |

| |
|

| | | | |<custom>

| | | <dir> |

| |
|

| |

| | |<embed> <fieldset> | | | <form> |

| |<hn>
|

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

| |<legend>
  • | | |<listing> <map> | | |<marquee> <menu> | | |<nobr> <object> | | |
      <option> | | |

      <plaintext> | | |

                                                            |
      |                |                          <select>                      |
      |                |                                                 |
      |                |                                              |
      |                |                                                    |
      |                |                         <tbody>                       |
      |                |                          |
      |                |                                                       |
      |                |
        | | |<xmp> | +----------------+--------------------------------------------------------------+ </source>

        "setCapture()" Syntax, Parameters and Note

        <source lang="javascript"> Note: Turns mouse capture on for the specified element. When mouse capture is set to an element, that element will fire all mouse-related events.

        Syntax:

        document.all.elementID.setCapture(param1) Parameters: param1 Optional; true or false, indicating whether or not the mouse capture affects the element"s parent.


        </source>

      <textarea> | | |<tfoot> | | |<thead>