成员未找到IE错误(IE 6,7,8,9) [英] Member not found IE error (IE 6, 7, 8, 9)

查看:155
本文介绍了成员未找到IE错误(IE 6,7,8,9)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先让我向任何IE用户指出(这不是Chrome,Safari或Firefox中的问题)提示提示;)

Let me just first point out to any IE users right now (this is not a problem in Chrome, Safari or Firefox) hint hint ;)

所以......我在IE中的工具提示存在问题,我有一个onmouseover监听器,用于所有可以恢复的元素,然后在我的鼠标悬停功能中,我有一个非常基本的跨浏览器声明......

So... I have a issue with my tooltips in IE, I have a onmouseover listener for all the elements which are to be hoverable and then in my mouseover function I have a very basic cross browser declaration as such...

var event = e || window.event,
    el = event.target || event.srcElement;

我一直遇到IE浏览器中不存在的窗口对象的问题,这是一个问题我添加了一个标志来忽略鼠标悬停从一个元素鼠标悬停到工具提示本身的路上(在允许的时间周期内,300毫秒)。换句话说,标志是忽略从原始鼠标悬停到工具提示的路径上的鼠标悬停。

I've been having issues with the window object not existing in IE or something, this has been a issue after I added a flag to ignore mouseover's from one element mouseover on the way to the tooltip itself (during the time cycle allowed, 300ms). In other words the flag is to ignore mouseovers on route to the tooltip from the original mouseover.

所以逻辑看起来像这样......

So that logic looks like this...

loadtip.refMouseOver = function (e) {

    var event = e || window.event, el = event.target || event.srcElement;
    //console.log(window); // <-- throws error in IE (Member not found)
    // Reset the lastHoveredRef data.
    tipManager.lastHoveredRef = null;
    tipManager.lastHoveredRef = [el, event];

    // true means there is a tip open still, so if no tip is open.
    if (tipManager.tipState !== true) { 
        tipManager.processTip(el, event);
    } else {        
        return; // do nothing
    }

}

会员找不到当我在工具提示仍然打开的情况下从IE中的一个元素快速悬停到下一个元素时会发生错误。

The "Member not found" error will occur when I hover from one element quickly to the next in IE with the tooltip still open.

我读了一下window.open并用try catch关闭了东西,但我没看到那是怎么回事。非常感谢任何帮助。

I read about window.open and close stuff with a try catch but I didn't see how that was relavent. Any help is greatly appreciated.

谢谢

推荐答案

好的我有发现问题。

总结一下,如果该函数调用在setTimeout内,IE基本上不会将事件传递给另一个函数。

To sum it up, basically IE will not pass a event to another function if that function call is within a setTimeout.

所以你可以通过创建事件的副本并传递它来欺骗IE,这是一个例子......

So you can trick IE by creating a copy of the event and passing that, here is a example of that...

var eventCopy = {};
for (var i in event) {
    eventCopy[i] = event[i];    
}

然后只需发送你的函数eventCopy,即使这是'总计' hack。

Then just send your function the eventCopy, even though this is a 'total' hack.

setTimeout(function () { yourFunction(eventCopy), yourDelayTime);

瞧它会起作用。

我应该补充一点,Internet Explorer只会创建对全局窗口事件的引用,这就是我们需要事件副本的原因。这是因为当setTimeout调用该函数时,windows.event已经通过,

I should add, that Internet Explorer will merely create a reference to the global window event which is why we need the copy of event. This is because by the time setTimeout calls the function, windows.event has already passed,

底线...不要尝试在setTimeout内发送一个事件,因为IE不会接受它。 IE 6,7& 8我的测试。

Bottom line... don't try to send a event inside a setTimeout because IE won't accept it. This is true for IE 6, 7 & 8 from my testing.

这篇关于成员未找到IE错误(IE 6,7,8,9)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆