1

javascript がここで機能しないのはなぜですか: http://kodiakgroup.com/customers.html特に IE 7 および 8?? Jquery の最初のドル記号のエラー: オブジェクトはこのプロパティまたはメソッドをサポートしていません。

コード全体:

    <!--[if IE]>
        <link rel="stylesheet" type="text/css" href="/css/ie.css" media="screen" />
        <script src="js/json2.js"></script>
    <![endif]-->

    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>


    <script type="text/javascript">
    $(function () {
        $('#vertical-filters input').attr('checked', true);//Set checkboxes as checked by default
        getCustomers(); //Initially call all customers

        function getCustomers()
        {   
            $('ul#customers').html('');//empty list
            var definedCategoryArray=new Array();

            for(var x=0; x< $('#vertical-filters li input').length; x++){
                var thisItem=$('#vertical-filters li input')[x];
                var thisItemName=$(thisItem).attr('id');
                if ($(thisItem).is(':checked'))
                    definedCategoryArray[thisItemName]=true;
                else
                    definedCategoryArray[thisItemName]=false;
            }

            $.getJSON('customers.json', function(data) {
                for(var index in definedCategoryArray){ //cycle through categories array
                    console.log(index + ':' + definedCategoryArray[index]);
                    for(var i=0; i<data.customers.length; i++){ //cycle through json data
                        if (definedCategoryArray[index]==true){//if the value in the array is true (item checked)
                                if(data.customers[i].category == index) //match category (from definedCategoryArray index) to items in json object to parse
                                    $('ul#customers').append('<li class="customerListItems"><a href="'+ data.customers[i].link +'"><img src="'+ data.customers[i].imageLink +'" alt="'+ data.customers[i].customerName +'" /></a></li>');
                        }
                    }
                }
            }).fail(function() { console.log( "error" ); });
        }

        //Toggle select all/deselect function
        $('.selectAllBoxes').unbind('click').bind('click', function (e) {
                e.preventDefault();
                var checkBoxes = $('#vertical-filters input');
                checkBoxes.prop("checked", !checkBoxes.prop("checked"));
                getCustomers();
        });

        //Check box checked function
        $('#vertical-filters input').change(function(){
            getCustomers();
        });


    }); 
    </script>
</head>
4

1 に答える 1

4

jQuery 2.0 は、IE バージョン 6、7、および 8 のサポートを終了したため、動作しません。リリースノートから:

IE 6/7/8 のサポート終了:古いバージョンをエミュレートする「互換表示」モードで使用されている場合、これは IE9 や IE10 にも影響する可能性があることに注意してください。これらの新しい IE バージョンが以前のモードに戻るのを防ぐために、常に X-UA-Compatible タグまたは HTTP ヘッダーを使用することをお勧めします。HTTP ヘッダーを使用できる場合は、ブラウザー パーサーの再起動の可能性を回避できるため、パフォーマンスがわずかに向上します。

ソース: jQuery 2.0 がリリースされました。

代わりに 1.9 を使用してみてください。

于 2013-05-08T22:55:15.800 に答える