最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

internet explorer - debugging javascript error in ie7? - Stack Overflow

programmeradmin2浏览0评论

All I get is this:

An error has occurred in the script on this page
line: 31
char: 5
error: expected identifier, string or number
code: 0
url: 

It's difficult to find that line since I have several external and internal scripts.

How can I debug this? (By the way, the scripts have no errors in chrome or firefox or ie8+)

All I get is this:

An error has occurred in the script on this page
line: 31
char: 5
error: expected identifier, string or number
code: 0
url: http://example.

It's difficult to find that line since I have several external and internal scripts.

How can I debug this? (By the way, the scripts have no errors in chrome or firefox or ie8+)

Share Improve this question asked Sep 29, 2010 at 16:02 MatthewMatthew 15.7k28 gold badges92 silver badges124 bronze badges 2
  • 3 Probably a dangling ma. It's always a dangling ma. – Stephen Commented Sep 29, 2010 at 16:04
  • Add line 31 into your answer from the page itself. Doesn't sound as though its ing from an external file as IE normally tells you it's a problem with an external file. – djdd87 Commented Sep 29, 2010 at 16:05
Add a ment  | 

6 Answers 6

Reset to default 2

You can download IETester which lets you use various versions of IE (6-8) and has built-in developer tools. They're not spectacular, but they're better than the nothing that old versions of IE provide.

Try debugging it with IE8's Developer Tools (press F12). You should be able to step through the JS code (from all your scripts) to find out what is wrong with line 31 / char 5.

If it says it's on the page, then it means the page itself. If it was in an external file, it would indicate that the error occured in something.js.

Open up your webpage, right click on the page and select "View Source". Go to line 31 and try and see what's wrong with it.

You can also enable debugging for IE at

(Tools -> Options -> (uncheck) Disable script debugging (Internet Explorer).  

After you disable it, IE will prompt you to debug when error occurs. Then you can debug with VS or MS script Editor.

Use Firefox with Firebug. Look at every external script around the line number mentioned in the error dialog. Trailing mas every time!

I got the same issue when try to to figure out what 's wrong with the code on IE7, after spending hours research and trying many different solutions, finally, the following two bars are great tools for me:

1) http://www.debugbar./

provide a convenience UI to with feature like source, style, DOM, Script, HTML check.

2) http://www.my-debugbar./wiki/CompanionJS/Installing

The main advantage of this is providing a console for IE6 or IE7, so you can see what are the error (in the console log)

  • Note:
  • they are both free
  • screen shot of both two toolbars

发布评论

评论列表(0)

  1. 暂无评论