componentFromPoint method
Returns the region of the current element that is located at the specified coordinates.
The returned scrollbar regions can be used for the doScroll method to simulate a click.
Syntax:
You can find the related objects in the Supported by objects section below.
Parameters:
Required. Integer that specifies the horizontal coordinate relative to the top-left corner of the browser window's client area. | |||||||
Required. Integer that specifies the vertical coordinate relative to the top-left corner of the browser window's client area. |
Return value:
String. One of the following values:
The specified coordinates are inside the client area of the current element. | |
The specified coordinates are outside the bounding rectangle of the object. | |
The specified coordinates are over the down scrollbar arrow. | |
The specified coordinates are over the horizontal scrollbar thumb. | |
The specified coordinates are over the left scrollbar arrow. | |
The specified coordinates are over the page-down region of the vertical scrollbar. | |
The specified coordinates are over the page-left region of the horizontal scrollbar. | |
The specified coordinates are over the page-right region of the horizontal scrollbar. | |
The specified coordinates are over the page-up region of the vertical scrollbar. | |
The specified coordinates are over the right scrollbar arrow. | |
The specified coordinates are over the up scrollbar arrow. | |
The specified coordinates are over the vertical scrollbar thumb. | |
The specified coordinates are over the bottom sizing handle. | |
The specified coordinates are over the lower-left sizing handle. | |
The specified coordinates are over the lower-right sizing handle. | |
The specified coordinates are over the left sizing handle. | |
The specified coordinates are over the right sizing handle. | |
The specified coordinates are over the top sizing handle. | |
The specified coordinates are over the upper-left sizing handle. | |
The specified coordinates are over the upper-right sizing handle. |
The sizing handles are displayed for an element when it is inside a contentEditable element or when the designMode is turned on.
Example HTML code 1:
This example illustrates the use of the componentFromPoint method:
|
||||
<head> <script type="text/javascript"> function GetRegionFromPoint () { var compTest = document.getElementById ("compTest"); var info = document.getElementById ("info"); if (compTest.componentFromPoint) { // Internet Explorer var region = compTest.componentFromPoint (event.clientX, event.clientY); if (region == "") { info.innerHTML = "inside"; } else { info.innerHTML = region; } } else { info.innerHTML = "Your browser does not support this example!"; } } </script> </head> <body onmousemove="GetRegionFromPoint ()"> <div id="compTest" style="width:200px;height:200px;overflow:scroll;"> <div style="width:600px;height:600px;background-color:#e0c0a0;"> </div> </div> Move the mouse pointer over the scrollable element! <br /><br /> The mouse pointer is over: <span id="info" style="color:red"></span> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
HTML elements:
a, abbr, acronym, address, applet, area, b, bdo, big, blockquote, body, button, caption, center, cite, code, col, colgroup, dd, del, dfn, dir, div, dl, dt, em, embed, fieldset, font, form, frame, frameset, h1, h2, h3, h4, h5, h6, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:reset, input:submit, input:text, ins, isindex, kbd, label, legend, li, listing, map, marquee, menu, nobr, noframes, object, ol, option, p, plaintext, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tr, tt, u, ul, var, xmp
Related pages:
External links:
User Contributed Comments