对象不支持IE中的属性或方法'bind'“错误

时间:2014-06-09 17:16:57

标签: javascript jquery

以下代码适用于IE以外的所有浏览器。我得到“对象不支持属性或方法'绑定'”错误。

var FilteredArray = (gAssessorsInfoArray.filter(ApplyFilters.bind(GetFilters(gServiceInfoArray[0].ServiceName, $("#YearsOfExperienceDropDown").val(), $("#P104DropDown").val(), GeographicalLocationArray, SubSpecialtiesArray, LanguagesSpokenArray))));                                   

我的HTML包含:

<script src="/files/404048/f93304/jquery-1.7.2.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script src="/files/404048/f96289/jquery.multiselect.js"></script>
<script src="/files/404048/f96289/jquery.multiselect.filter.js"></script>
<script src="/files/404048/f96289/prettify.js"></script>
<script src="/files/404048/94413/jquery.tipTip.js"></script>
<script src="/files/404048/94414/jquery.tipTip.minified.js"></script>

我的ApplyFilters功能:

function ApplyFilters(Item) {           
    var i;

    for(var i = 0; i < this.length; i += 1)
    {   
        if(!this[i](Item))
            return false;               
    }

    return true;            
}

function GetFilters(ServiceName, YearsOfExperience, P104, GeographicalLocation, SubSpecialties, LanguagesSpoken) {
    var Filters = [];

    if (ServiceName) {
        Filters.push(function (Item) {
            return (Item.AvailableForRegular.indexOf(ServiceName) > -1 || Item.AvailableForCAT.indexOf(ServiceName) > -1);
        });
    }

    if (YearsOfExperience != '') {
        Filters.push(function (Item) {
            return Item.YearsOfExperience === YearsOfExperience;
        });
    }

    if (P104 != '') {
        Filters.push(function (Item) {
            return Item.P104 === P104;
        });
    }

    if (GeographicalLocation != '') {
        Filters.push(function (Item) {
            var FoundCounter = 0;                                                    

            for (var i = 0; i < GeographicalLocation.length; i++) {
                if (Item.GeographicalLocation.indexOf(GeographicalLocation[i]) > -1)                                            
                    FoundCounter++;
            }

            if(GeographicalLocation.length == FoundCounter)                
                return true;
            else
                return false;
        });
    }

    if (SubSpecialties != '') {
        Filters.push(function (Item) {
            var FoundCounter = 0;

            for (var i = 0; i < SubSpecialties.length; i++) {
                if(Item.SubSpecialties.indexOf(SubSpecialties[i]) > -1)
                    FoundCounter++;
            }

            if (SubSpecialties.length == FoundCounter)                
                return true;
            else
                return false;
        });
    }

    if(LanguagesSpoken != '') {
        Filters.push(function (Item) {
            var FoundCounter = 0;

            for (var i = 0; i < LanguagesSpoken.length; i++) {
                if (Item.LanguagesSpoken.indexOf(LanguagesSpoken[i]) > -1)                                            
                    FoundCounter++;
            }

            if (LanguagesSpoken.length == FoundCounter)
                return true;
            else
                return false;
        });
    }

    return Filters;
}

0 个答案:

没有答案