Javascript 调试 IE 错误对象预期
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6232596/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Debug IE error Object expected
提问by user782993
I am trying to debug this error but it does not give me enough info ti figure it out? or does it???
我正在尝试调试此错误,但它没有给我足够的信息来解决问题?或者是吗???
Webpage error details
网页错误详情
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C) Timestamp: Fri, 3 Jun 2011 20:53:11 UTC
用户代理:Mozilla/4.0(兼容;MSIE 8.0;Windows NT 6.0;Trident/4.0;GTB6;SLCC1;.NET CLR 2.0.50727;Media Center PC 5.0;.NET CLR 3.5.30729;.NET CLR 3.0.30729; .NET4.0C) 时间戳:2011 年 6 月 3 日星期五 20:53:11 UTC
Message: Object expected Line: 1 Char: 1 Code: 0 URI: http://c5beta.dealercontrol.net/inventory/1-2l1305517101/Mercedes-Benz_E-Class_E350_White_2010
消息:预期对象行:1 字符:1 代码:0 URI:http: //c5beta.dealercontrol.net/inventory/1-2l1305517101/Mercedes-Benz_E-Class_E350_White_2010
Message: Object expected Line: 1 Char: 1 Code: 0 URI:
消息:预期对象行:1 字符:1 代码:0 URI:
Message: Object expected Line: 1 Char: 1 Code: 0 URI:
消息:预期对象行:1 字符:1 代码:0 URI:
Message: Object expected Line: 1 Char: 1 Code: 0 URI:
消息:预期对象行:1 字符:1 代码:0 URI:
回答by Michael Berkowski
Without even seeing code, my gut tells me that you have a trailing comma somewhere inside an array or object literal. IE will choke on those with the Object expected
error, usually at line 1 (which is meaningless).
甚至没有看到代码,我的直觉告诉我你在数组或对象文字中的某处有一个尾随逗号。IE 会扼杀那些有Object expected
错误的人,通常在第 1 行(这是毫无意义的)。
Something like this:
像这样的东西:
var something = [
"val1",
"val2",
"val3",
"val4",
];
^^^^^
回答by Halcyon
Install IE9 and pray it produces the same error. Press F12 to open the developer console which is somewhat capable of doing useful debugging.
安装 IE9 并祈祷它产生相同的错误。按 F12 打开开发者控制台,它可以进行一些有用的调试。
Have fun.
玩得开心。
回答by Sundhar
You can install 'IEDeveloper' tool onto IE8 or IE7 (i guess you will not using IE6, if you are not lucky enough :)), and debug the page and that will show the exact location where the problem is , shortcut F12
您可以在 IE8 或 IE7 上安装“IEDeveloper”工具(我猜您不会使用 IE6,如果您不够幸运:)),然后调试页面,这将显示问题所在的确切位置,快捷键 F12