Visual Studio 2008中的Javascript调试

时间:2022-01-16 02:56:36

I'm trying to debug javascript code just by adding a breakpoint in VS2008, but the debugger's not stopping. Do I have to do some special setup in order to enable javascript debugging? Or does the code have to be in a separate js file?

我试图通过在VS2008中添加断点来调试javascript代码,但调试器没有停止。我是否必须进行一些特殊设置才能启用javascript调试?或者代码必须在一个单独的js文件中?

4 个解决方案

#1


7  

Did you uncheck the checkboxes in the settings

您是否取消选中设置中的复选框

Tools-->Internet Options-->Advanced-->Browsing [heading]-->Uncheck "Disable Script Debugging (Internet Explorer)" and Uncheck "Disable Script Debugging (Other)"

工具 - > Internet选项 - >高级 - >浏览[标题] - >取消选中“禁用脚本调试(Internet Explorer)”并取消选中“禁用脚本调试(其他)”

Sometimes you need to restart the browser to get VS2008 to recognize that it has made some changes.

有时您需要重新启动浏览器才能让VS2008识别它已经进行了一些更改。

Have you tried to stick the "debugger;" keyword into your JavaScript file? This usually never fails me.

你试过坚持“调试器”吗?关键字到你的JavaScript文件?这通常不会让我失望。

If you have IE8, you can debug right in the browser itself.

如果你有IE8,你可以在浏览器本身进行调试。

#2


0  

Any particular browser? Mainly it works with IE, and needs script debugging enabled in the IE internet options (advanced => browsing).

任何特定浏览器?主要是它适用于IE,并且需要在IE互联网选项(高级=>浏览)中启用脚本调试。

#3


0  

I don't know about VS2008, but I know I've never been able to get the debugger to stop on a breakpoint in an aspx (as opposed to a linked js file).

我不知道VS2008,但我知道我从来没有能够让调试器停在aspx的断点上(而不是链接的js文件)。

If you are not running this in a project, but just debugging on the fly, be sure to attach to the browsers' process.

如果您没有在项目中运行它,而只是动态调试,请务必附加到浏览器的进程。

#4


0  

I know it's not what you asked, but I gotta plug Firebug for JS debugging, including breakpoints, watch statements, stepping, and a live JS console.

我知道这不是你问的问题,但我必须插入Firebug进行JS调试,包括断点,监视语句,步进和实时JS控制台。

#1


7  

Did you uncheck the checkboxes in the settings

您是否取消选中设置中的复选框

Tools-->Internet Options-->Advanced-->Browsing [heading]-->Uncheck "Disable Script Debugging (Internet Explorer)" and Uncheck "Disable Script Debugging (Other)"

工具 - > Internet选项 - >高级 - >浏览[标题] - >取消选中“禁用脚本调试(Internet Explorer)”并取消选中“禁用脚本调试(其他)”

Sometimes you need to restart the browser to get VS2008 to recognize that it has made some changes.

有时您需要重新启动浏览器才能让VS2008识别它已经进行了一些更改。

Have you tried to stick the "debugger;" keyword into your JavaScript file? This usually never fails me.

你试过坚持“调试器”吗?关键字到你的JavaScript文件?这通常不会让我失望。

If you have IE8, you can debug right in the browser itself.

如果你有IE8,你可以在浏览器本身进行调试。

#2


0  

Any particular browser? Mainly it works with IE, and needs script debugging enabled in the IE internet options (advanced => browsing).

任何特定浏览器?主要是它适用于IE,并且需要在IE互联网选项(高级=>浏览)中启用脚本调试。

#3


0  

I don't know about VS2008, but I know I've never been able to get the debugger to stop on a breakpoint in an aspx (as opposed to a linked js file).

我不知道VS2008,但我知道我从来没有能够让调试器停在aspx的断点上(而不是链接的js文件)。

If you are not running this in a project, but just debugging on the fly, be sure to attach to the browsers' process.

如果您没有在项目中运行它,而只是动态调试,请务必附加到浏览器的进程。

#4


0  

I know it's not what you asked, but I gotta plug Firebug for JS debugging, including breakpoints, watch statements, stepping, and a live JS console.

我知道这不是你问的问题,但我必须插入Firebug进行JS调试,包括断点,监视语句,步进和实时JS控制台。