不实现接口元素

does not implement interface Element

本文关键字:元素 接口 实现      更新时间:2023-09-26

首先,我检查了这篇文章,它似乎并没有完全解决我所遇到的问题。

我使用的代码看起来像这样,无论出于什么原因,它拒绝在Firefox中运行,并给出"参数1的窗口"的错误。getDefaultComputedStyle不实现接口元素。这段代码用于切换选项卡,目前可以在testing.worldwidejamie.com上找到。

下面是我的完整代码:
$(document).ready(function(){
    var content = undefined;
    $('#tabs .tab-list li').each(function(){
    $(this).on('click',function() {
        // buttons
        $(this).addClass('active').siblings().removeClass('active');
        // content
        if(content !== undefined){
            content.hide();
        }
        var currentAttrValue = $("a", this).attr('href');
        content = $(currentAttrValue);
        content.show(); 

        });
    });
});

这适用于最新版本的Chrome, Safari和IE,但不适用于Firefox。

提前感谢您的帮助。

制表符的代码可以正常工作。问题实际上是在你的platform.js脚本。通过Firebug检查页面的控制台输出后,脚本在该脚本中中断。

您可以在这里看到:http://jsfiddle.net/Au7EJ/3/您的tabs.js脚本按照您期望的方式运行。只对你的代码做了一个修改,因为没有必要用一个值初始化'content',所以我在代码中修改了它。

$(document).ready(function () {
    var content; // just a declaration is enough here
    $('#tabs .tab-list li').each(function () {
        $(this).on('click', function () {
            // buttons
            $(this).addClass('active').siblings().removeClass('active');
            // content
            if (content !== undefined) {
                content.hide();
            }
            var currentAttrValue = $("a", this).attr('href');
            content = $(currentAttrValue);
            content.show();
        });
    });
});

希望这能对你的问题有所帮助!