编辑下面的代码:【加编码】
<html> <head> <script> function myFunction(e) { alert(e.target); } </script> </head> <body onclick="myFunction(event)"> <p> Click on a paragraph. An alert box will alert the element that triggered the event.</p> <p> <strong>Note:</strong> The target property returns the element that triggered the event, and not necessarily the eventlistener's element.</p> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂