对象不支持 IE7 jQuery 中的此属性或方法错误

Object doesn't support this property or method error in IE7 jQuery

本文关键字:属性 方法 错误 不支持 IE7 jQuery 对象      更新时间:2023-09-26

IE7 显示以下错误消息:(除 IE7 外,没有其他浏览器显示任何错误)

Message: Object doesn't support this property or method
Line: 97
Char: 2

第 97 行是这样的:

$('.megamenu').megaMenuCompleteSet({

完整的JavaScript代码是这样的:

<script> 
$(document).ready(function($){
    $('.megamenu').megaMenuCompleteSet({
        menu_speed_show : 300, // Time (in milliseconds) to show a drop down
        menu_speed_hide : 200, // Time (in milliseconds) to hide a drop down
        menu_speed_delay : 200, // Time (in milliseconds) before showing a drop down
        menu_effect : 'hover_slide', // Drop down effect, choose between 'hover_fade', 'hover_slide', etc.
        menu_click_outside : 1, // Clicks outside the drop down close it (1 = true, 0 = false)
        menu_show_onload : 0 // Drop down to show on page load (type the number of the drop down, 0 for none)
    });
});
</script>

有人可以告诉我第 97 行有什么问题吗?

谢谢!


更新已解决:

使用的是最新的,我自己修复了它,这都是我的错,我用不同的版本加载了两次 jquery lib,除了 IE7 之外,它在其他浏览器上没有任何麻烦。但是调试后,我发现加载并删除了多个库,并且没有错误:)

谢谢大家!

您使用的是哪个版本的 MegaMenu 脚本?我可以在他们的更新日志中看到这一点:

06/23/2012 – Version 2.11
Fixed an issue occurring under IE7 in megamenu.js

我不确定这是否是问题所在,但您不需要将 JQuery 作为参数传递,因为它是全局的,因此:

$(document).ready(function($){

应该是:

$(document).ready(function(){

这可能是问题所在,因为您的 JQuery 插件似乎无法正常工作。