简体   繁体   English

意外调用方法或属性。 的jquery.js?版本1.7.1 =

[英]Unexpected call to method or property access. jquery.js?ver=1.7.1

I'm getting 'Unexpected call to method or property access' in IE7 and my script won't work in IE8 and I can't for the life of me figure out why. 我在IE7中收到“对方法或属性访问的意外调用”,而我的脚本在IE8中无法正常工作,我一生都无法弄清原因。

I've been using developer tools in IE (woohooo!) but it isn't much help. 我一直在IE中使用开发人员工具(woohooo!),但并没有太大帮助。 The error I am getting is in Jquery: 我得到的错误是在Jquery中:

SCRIPT65535: Unexpected call to method or property access. SCRIPT65535:对方法或属性访问的意外调用。 jquery.js?ver=1.7.1, line 3 character 31871 jquery.js?ver = 1.7.1,第3行字符31871

It works perfectly fine in IE9, Safari, FF and chrome. 它在IE9,Safari,FF和chrome中可以正常工作。

On the Html page, I click the following link which passes the vale of the data-tax attribute to the script. 在“ HTML”页面上,我单击以下链接,该链接将数据税属性的值传递给脚本。 Do you think perhaps it has to do anything with html5? 您认为它可能与html5有关系吗? Any pointers will be much appreciated. 任何指针将不胜感激。

For example, if you click Brad Pitt, it should display movies Brad Pitt is in: 例如,如果您单击Brad Pitt,它将显示Brad Pitt所在的电影:

<li class="ajaxFilterItem brad-pitt af-actor-6 filter-selected" data-tax="actor=6"><a href="#" class="ajax-filter-label"><span class="checkbox"></span>Brad Pitt</a> (1)</li>

I pass the following value to 我将以下值传递给

filterAjaxify("actor=6")

And this is the offending code: 这是令人反感的代码:

(function($){
    var isRunning = false;
    // Return an array of selected navigation classes.
    function loopSelected(_node) {
        var _arr = [];
        _node.each(function(){
            var _class = $(this).attr('data-tax');
            _arr.push(_class);
        });
        return _arr;
    };

    // Animate the progress bar based on Ajax step completion.
    function increaseProgressBar(percent){
        $('div#progbar').animate({
            width: percent + '%'
        },30);
    };

    // Join the array with an & so we can break it later.
    function returnSelected(){
        var selected = loopSelected($('li.filter-selected'));
            return selected.join('&');
    };

    // When the navigation is clicked run the ajax function.
    $('a.ajax-filter-label, a.paginationNav, a.pagelink').live('click', function(e) {
        if(isRunning == false){
            isRunning = true;
            e.preventDefault();
            var relation = $(this).attr('rel');
            if($(this).parent('li').length > 0) {
                $(this).parent('li').toggleClass('filter-selected');
                thisPage = 1;
            }
            if(relation === 'next'){
                thisPage++;
            } else if(relation === 'prev') {
                thisPage--;
            } else if($(this).hasClass('pagelink')){
                thisPage = relation;
            }
            filterAjaxify(returnSelected());
        }
    });

    // Do all the ajax functions.
    function filterAjaxify(selected){
        $.ajax({
            url: ajaxurl,
            type: 'post',
            data: {
                "action":"affilterposts",
                "filters": selected,
                "posttypes": posttypes,
                "qo": qo,
                "paged": thisPage,
                "_ajax_nonce": nonce
            },
            beforeSend: function(){
                $('div#ajax-loader').fadeIn();
                $('section#ajax-filtered-section').fadeTo('slow',0.4);
                increaseProgressBar(33);
            },
            success: function(html){
                increaseProgressBar(80);
                $('section#ajax-filtered-section').html(html);
            },
            complete: function(){
                $('section#ajax-filtered-section').fadeTo('slow',1);
                increaseProgressBar(100);
                $('div#ajax-loader').fadeOut();
                isRunning = false;
            },
            error: function(){}
        });
    };
})(jQuery);

The <section> is new in HTML5, older IE doesn't know how to digest that, and has some DOM issues when you try and append things to such elements. <section>是HTML5中的新功能,较旧的IE不知道该如何消化,并且在尝试将内容附加到此类元素时会出现DOM问题。

Eg http://jsfiddle.net/EKU7R/ 例如http://jsfiddle.net/EKU7R/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 意外调用方法或属性。 在JQUERY - Unexpected call to method or property access. in JQUERY jQuery v1.8.3在ie 8中创建错误,即7“对方法或属性访问的意外调用”。 - jQuery v1.8.3 creating error in ie 8 and ie 7 “Unexpected call to method or property access.” 意外调用方法或属性。 微软客户关系管理 - Unexpected call to method or property access. MS CRM (仅在IE中)SCRIPT65535:对方法或属性访问的意外调用。 main.js,第152行字符28 - (Only in IE) SCRIPT65535: Unexpected call to method or property access. main.js, line 152 character 28 IE错误“意外调用方法或属性。 行:113字符:460代码:0” - IE Error “Unexpected call to method or property access. Line: 113 Char: 460 Code: 0” 对方法或属性访问的意外调用? - unexpected call to method or property access? 在jQuery中对IE8上的方法或属性访问进行了意外调用 - Unexpected call to method or property access on IE8 in jQuery IE中出现奇怪的jQuery错误:对方法或属性访问的意外调用 - Strange jQuery error in IE: Unexpected call to method or property access jQuery .find()错误:“对方法或属性访问的意外调用” - jQuery .find() error: “Unexpected call to method or property access” JavaScript错误:对方法或属性访问的意外调用 - JavaScript Error:Unexpected Call To Method Or Property Access
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM