go
Expand Minimize
This topic has not yet been rated - Rate this topic

msElementsFromRect method

Returns an node list of elements that are under a rectangle defined by left, top, width, and height.

Internet Explorer 10

Syntax

object.msElementsFromRect(left, top, width, height, retVal)

Parameters

left [in]

Type: Floating-point

top [in]

Type: Floating-point

width [in]

Type: Floating-point

height [in]

Type: Floating-point

retVal [out, retval]

Type: NodeList

Remarks

The following code sample creates a series of overlapping <div> blocks of varying colors. When you click, it uses msElementsFromRec() to get all the elements that are under a 50 pixel rectangular area and changes 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.msElementsFromRect(e.clientX - 25, e.clientY - 25, 50, 50); // captures elements within 50px block


 

 

Send comments about this topic to Microsoft

Build date: 11/27/2012

Community Additions

ADD
© 2013 Microsoft. All rights reserved.