I have the following code:
document.oncontextmenu = function(evt) {
evt = evt || window.event;
console.log(evt.target, evt.toElement, evt.srcElement);
};
By clicking the right mouse button on a <div class="foo"></div>
, returns this:
div.foo, div.foo, div.foo
By clicking the right mouse button on a <input>
, returns this:
input, input, input
All seem to bring the same result. Is there any situation that one of them has different use than the others?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…