我的链接上有一个onclick
属性:
<a href="#" onclick="myFunc(1,2,3)">click</a>
它指向JavaScript中的此事件处理程序:
function myFunc(p1,p2,p3) {
//need to refer to the current event object:
alert(evt.type);
}
由于事件对象evt没有传递给参数,还可以获取这个对象吗?
我试过window.event
和$(window.event)
,但都是undefined
。
有什么想法吗?
https://stackoverflow.com/questions/5849370
复制相似问题