JavaScript Reference/Javascript Properties/srcElement

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

"srcElement" Example

   <source lang="javascript">
   

<html> <body> <script language="JavaScript">

   function function1() {
       alert(window.event.srcElement.id);
   }

</script> <body id="myBody" onclick="function1();"> <button id="myButton1" onclick="function1();">Button One</button> <button id="myButton2" onclick="function1();">Button Two</button> </body> </body> </html>


     </source>
   
  


"srcElement" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |event | +----------------+--------------------------------------------------------------+

     </source>
   
  


"srcElement" Syntax and Note

   <source lang="javascript">

Note: Read and write property. The object that fires the event.

Syntax:

window.event.srcElement = value


     </source>