IE 8中页面加载出错(触发兼容性视图)

时间:2011-03-16 04:59:11

标签: view ie8-compatibility-mode compatibility

消息:预期的标识符,字符串或数字 行:136 查尔:8 代码:0

这是发生的部分 - (第6行 - '},')

                <script type="text/javascript">
                    jQuery(document).ready(function($) {
                        ThreeWP_Ajax_Search.init({
                            name : "Default Ajax Search that works with Twentyten 2011-03-14 23:09:31",
                            name_md5 : "f02b704d9a6e3111c721adb5de87e883",
                            chars_before_search : 0,
                            time_before_search : 200,
                            cursor_key_navigation : 1,
                            cursor_key_navigation_loops : 1,
                            results_to_display : 10,
                            selector_search_form : "#searchform",
                            selector_search_input : "#s",
                            selector_search_results : ".hentry",
                            selector_search_results_content : ".threewp_ajax_search_results_content ul",
                            display_format_header : "<div class=\"threewp_ajax_search_results_content\">\
<ul>",
                            display_format_item : "<li class=\"%item_class%\">%item%</li>",
                            display_format_footer : "</ul>\
</div>",
                            callbacks : {
                                "after_init" : function(form_object, callback){
    $("input", form_object).attr("autocomplete", "off");
    callback();
},
                                "after_fetch" : function(form_object, callback){
    callback();
},
                                "before_hide" : function(form_object, callback){
    $(".threewp_ajax_search_container", form_object).fadeTo(250, 0.0, callback);
}
,
                                "before_show" : function(form_object, callback){
    $(".threewp_ajax_search_container", form_object).fadeTo(250, 1.0, callback);
}
,
                            },
                            search_url : "http://domain.com/?s="
                        });
                    });
                </script>

1 个答案:

答案 0 :(得分:1)

before_show

之后,您的}行有一个逗号
"before_show" : function(form_object, callback){
    $(".threewp_ajax_search_container", form_object).fadeTo(250, 1.0, callback);
}
,

尾随逗号在JS中并不严格合法,IE会对它们产生错误。删除尾随的逗号,它应该可以工作。