-1
我动态加载一个.htm文件的iframe内(与.htm是在我的域)这样的:通过事件对象在函数内部的iframe IE8
el.innerHTML = "<iframe id='frmBook' onload='on_load()' src='blabla.htm'";
我ON_LOAD是这样的:
function on_load() {
document.getElementById("frmBook").contentWindow.document.body.ondblclick = function(event) {
var oTextRange;
if (!document.selection) {
oTextRange = window.getSelection();
if (oTextRange.rangeCount > 0) oTextRange.collapseToStart();
}
getWord(event);
}
document.getElementById("frmBook").contentWindow.document.body.oncontextmenu = function(event) {
showContextMenu(event);
return false;
}
}
现在我需要传递事件对象,因为它在getWord()和showContextMenu()中都使用。它用于getWord()获取e.target.id(或e.srcElement),并在showContextMenu()中使用e.page.X.麻烦的是,IE8无法识别(未定义)事件对象,因此它无法通过。有没有办法通过IE8的事件对象?
在此先感谢!