Event source element
<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>