我希望每个人都做得很好。
我属于Actionscript背景,刚刚开始使用FlashCCHTML-5画布。如何在FlashCCforHTML-5画布中为单击事件获取event.target或event.currentTarget。
就像我们以前在3.0里做的那样:
btn.addEventListener(MouseEvent.CLICK , go);
function go(evt:MouseEvent) {
trace(" evt - "+evt.currentTarget); // It will let us know the clicked target
}用于HTML-5
btn.addEventListener('click' , go.bind(this));
function go(evt){
console.log(" evt - "+evt.????t); // what is the correct syntax here?
}谢谢,
发布于 2015-04-10 11:26:27
您可以使用evt.target。
另见下文的其他可能性:
document.querySelector("div").addEventListener("click", function(e) {console.log(e);});<div>F12, then click here</div>
https://stackoverflow.com/questions/29560153
复制相似问题