我正在尝试使用以下代码获取id,但它不适用于IE8。请帮我解决。
$.ShironekoTarot.prototype.result = function (event) {
var targetElement = null;
if (!event) event = window.event;
if (event.target) {
targetElement = event.target;
} else if (event.srcElement) {
targetElement = event.srcElement;
}
if ($(targetElement).is(this.options.cardNode) || !this.started || !this.controlable) {
return;
}
this.controlable = false;
var self = this,
image = new Image();
image.onload = function () {
self._result(event.currentTarget);
};
var id = targetElement.id;
this.options.cardResult = id;
image.src = this.data.image;
};