In many cases we need to get the event source object to make changes to its properties, and there are two ways to get the event source in the event response function
In the JavaScript event response, there are many situations where we need to get the event source object to make changes to its properties, such as changing the SRC attribute of IMG. There are two ways to get event sources in an event response function: The first: directly passing as a parameter. For example, the code is as follows: <div id= "myID" onclick= "show (this);" >text</div> <script type= "Text/javascript" > function show (obj) {window.alert (obj.id); </script> Second: Drop the hidden event object directly. The event object has a Srcelement property that can be accessed directly by its code as follows: <div id= "myID" onclick= "Show ();" >text</div> <script type= "Text/javascript" > Function Show () {Window.alert (event.srcElement.id); } </script>