需要在Internet Explorer脚本错误中找到line / char的实际位置? [英] Need to find actual location of line/char in Internet Explorer Script errors?

查看:128
本文介绍了需要在Internet Explorer脚本错误中找到line / char的实际位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IE中收到脚本错误:



行:59
Char:71
错误:预期的标识符,字符串或号码
代码:0



行59,字符71似乎并不符合我的代码。它甚至没有说什么文件,但我看过我的主要的javascript文件,查看页面的源码等。



这是发生在我之前和我看着周围,直到我终于找到一个错误的代码 - 通常是逗号 - 但我真的想从这些行/字符数字中使用一些。我读了一次,它是对IE读取页面的内部版本的引用。有没有人有关于如何找出这些数字实际上意味着什么的信息,并看到导致问题的代码行?



欣赏任何帮助!

解决方案

我发现IE行#/ Char#是无用的更麻烦,那么这是值得的。



如果你包含多个javascript文件,它所有的都是一行#和char#,这是很多工作要连接所有的脚本一起来弄清楚错误在哪里。



如果我可以使用firebug在firefox中找到错误,那么这是最简单的方法。如果这是一个仅IE的问题,我所做的是在Internet选项中启用脚本调试,


  1. 转到工具 - > Internet选项... - >高级 - >禁用脚本调试(Internet Explorer)

  2. 转到工具 - > Internet选项... - >高级 - >禁用脚本调试(其他)



    然后在发生错误时附加Visual Studio Debugger。


如果您使用IE 8,安装开发者工具栏,因为它具有内置在调试器中。



如果您真的很热衷于不使用调试器,只需查看源代码并获取行#,您可以在IE Developper中尝试查看 - >原始源



在您的情况下,您必须注意对象文字中的逗号。

  var obj = {
a:1,
b:2,
}

或使用re命名变量像类这样的服务关键字,已经烧了我很多次。
以下是保留关键字的列表


I'm receiving a script error in IE:

Line: 59 Char: 71 Error: Expected identifier, string, or number Code: 0

Line 59, character 71 don't seem to actually correspond to my code. It doesn't even say what file, but I've looked at my main javascript file, viewing the page source, etc.

This has happened to me before and I've looked around until I finally find an error with the code -- usually a comma -- but I would really like to get some use out of these line/char numbers. I read once that it's a reference to the internal version of the page that IE reads from.

Does anyone have information on how to find out what these numbers actually mean and see the line of code that's causing the problem?

Appreciate any help!

解决方案

I've found IE Line # / Char #'s to be useless or more hassle then it's worth.

If you're including multiple javascript files and all it gives you is a line # and char # it's alot of work to concatenate all the scripts together to figure it out where the error is.

If I can find the error in firefox using firebug then that's the easiest way. If it's an IE only problem what I do is enable script debugging in Internet Options,

  1. Go to Tools->Internet Options…->Advanced->Disable Script Debugging (Internet Explorer)
  2. Go to Tools->Internet Options…->Advanced->Disable Script Debugging (Other)

    then attach Visual Studio Debugger when an error occurs.

If you're using IE 8, install the developer toolbar because it has a built in debugger.

If you are really keen on not using a debugger and just viewing the source and getting the line # you can try View -> Original Source in the IE Developper toolbar.

In your case you gotta watch out for trailing comma's in object literals

var obj = { 
a: 1, 
b: 2,
}

Or naming a variable with a reserved keyword like "class", that has burned me many times. Here is a list of reserved keywords

这篇关于需要在Internet Explorer脚本错误中找到line / char的实际位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆