DHTML Methods
Returns the component located at the specified coordinates.
sScrollComponent = object.componentFromPoint (
iCoordX, iCoordY )
iCoordX |
Required. Specifies the client window coordinate of x. |
iCoordY |
Required. Specifies the client window coordinate of y. |
String. Possible return values include:
"" |
The component is inside the client area of the object. |
outside |
The component is outside the bounds of the object. |
scrollbarDown |
The down scroll arrow is at the specified location. |
scrollbarHThumb |
The horizontal scroll thumb or box is at the specified location. |
scrollbarLeft |
The left scroll arrow is at the specified location. |
scrollbarPageDown |
The page-down scroll bar shaft is at the specified location. |
scrollbarPageLeft |
The page-left scroll bar shaft is at the specified location. |
scrollbarPageRight |
The page-right scroll bar shaft is at the specified location. |
scrollbarPageUp |
The page-up scroll bar shaft is at the specified location. |
scrollbarRight |
The right scroll arrow is at the specified location. |
scrollbarUp |
The up scroll arrow is at the specified location. |
scrollbarVThumb |
The vertical scroll thumb or box is at the specified location. |
The componentFromPoint method is applicable to any object that can be given scroll bars through cascading style sheets ( CSS ).
The componentFromPoint method may not consistently return the same object when used with the onmouseover event. Because a user's mouse speed and entry point varies, different components of an element fire the onmouseover event.
For example, when a user moves the mouse cursor over a TEXTAREA object with scroll bars, the event may fire when the mouse enters the component border, the scroll bars, or the client region. Once the event has fired, the expected element may not be returned unless the scroll bars were the point of entry for the mouse. In this case, the onmousemove event can be used to provide more consistent results.
The example employs the componentFromPoint method to determine what object the mouse is hovering over.
Sample Code
<script language="JavaScript">
function trackScroll ( ) {
var sElem = "";
sElem = document.body.componentFromPoint (
event.clientX, event.clientY );
window.status = "mousemove " + event.clientX +
", " + event.clientY +
" The mouse pointer is over: " + sElem;
}
</script>
</head>
<body onmousemove="trackScroll ( )">
<p>Hover the mouse pointer over any scroll bar.
See the window status field . . . </p>
<div align="center">
<textarea cols=80 rows=20>This text area forces
scroll bars to appear on the window.</textarea>
</div>
This feature requires Microsoft® Internet Explorer® 5 or later.
Show me
BODY, DIV, SPAN, TEXTAREA
doScroll, onScroll