go
Expand Minimize

msElementsFromPoint method

Returns a node list of elements that are “underneath” or intersect a point defined by given x/y coordinates.

Internet Explorer 10

Syntax

object.msElementsFromPoint(x, y, retVal)

Parameters

x [in]

Type: Floating-point

y [in]

Type: Floating-point

retVal [out, retval]

Type: NodeList

List of nodes that are under or intersect the x/y coordinates.

Return value

Type: NodeList

List of nodes that are under or intersect the x/y coordinates.

Remarks

The list is sorted by z-order, with the first element as the topmost in the order.

The following code sample creates a series of overlapping <div> blocks of varying colors. When you click one, it uses msElementsFromPoint() to get all the elements under the click position and change the background color to gray. Because all elements are returned, including <body> and <html> we only change the background color on the elements with a nodeName of DIV.


         var hitTargets = document.msElementsFromPoint(e.clientX, e.clientY); // get elements from point                 


 

 

Show:
© 2014 Microsoft