// this e works document.getElementById("p").oncontextmenu = function(e) { e = e || window.event; var target = e.target || e.srcElement; console.log(target); }; // this e is undefined function doSomething(e) { e = e || window.event; var target = e.target || e.srcElement; console.log(target); } <p id="p" onclick="doSomething(e)"> <a href="#">foo</a> <span>bar</span> </p> 也有人提出过类似的问题。 …