JavaScript Reference/Javascript Methods/elementFromPoint

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

"elementFromPoint()" Example

   <source lang="javascript">
   

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

   var m = document.elementFromPoint(150, 150);
   var n = m.tagName;
   alert("The element located at point (150, 150) is "+n); 

} </script> <button onclick="function1();">Click to reveal element</button> </body> </html>


     </source>
   
  


"elementFromPoint()" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |document | +----------------+--------------------------------------------------------------+

     </source>
   
  


"elementFromPoint()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Returns the element located at the specified point.

Syntax:

document.elementFromPoint(param1, param2)

Parameters:

   param1   Required; the X coordinate of the specified point.
   param2   Required; the Y coordinate of the specified point.
   
     
     </source>