开发者

debugging javascript error in ie7?

All I get is this:

An err开发者_高级运维or has occurred in the script on this page
line: 31
char: 5
error: expected identifier, string or number
code: 0
url: http://example.com

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+)


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 commas 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.com/

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

2) http://www.my-debugbar.com/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

debugging javascript error in ie7?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜