I'm using a component written in JavaScript. The component is exposing some events. The problem is I can't figure out who is the sender. They don't provide an instance of the sender as a parameter (like jQuery does).
My question is: Is 开发者_如何学JAVAthere any way to hook up the event using JavaScript/jQuery or any other way to get the sender?
All I know is the event name.
If I am correct in what you want: event.srcElement
http://msdn.microsoft.com/en-us/library/ms534638%28VS.85%29.aspx
Note: This does not work in Firefox.
For FF and most likely Webkit:
img.onclick = function (e) {
if (window.event) e = window.event;
var srcEl = e.srcElement? e.srcElement : e.target;
// srcEl now can be used x-browser.
// (rest of the script here)
}
精彩评论