如何设置在Visual Studio 2008或Visual Studio 2010中的JavaScript断点 [英] How to set JavaScript breakpoints in Visual Studio 2008 or Visual Studio 2010

查看:152
本文介绍了如何设置在Visual Studio 2008或Visual Studio 2010中的JavaScript断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Visual Studio 2010来调试JavaScript code,但我不能设置断点。

I'm trying to debug JavaScript code using Visual Studio 2010, but I can't set breakpoints.

我怎样才能做到这一点?

How can I do this?

我刚刚发现了一些,每次我试图调用一个函数,无论什么功能,在JavaScript中,莫名其妙的 jQuery的和微软的Ajax框架的JavaScript抓住它,并检查该文件已准备就绪( document.onready 或其他),并永远不会返回控制返回给函数I敢叫!为什么地球上是这样做呢?我从来没有要求它!

I just noticed something, every time I try to call a function, no matter what function, in JavaScript, somehow jQuery and Microsoft's Ajax framework JavaScript captures it and checks if the document is ready (document.onready or other) and never returns the control back to the function I'm calling! Why on earth is it doing this? I've never asked for it to!

我的一切都是引用这些库,脚本/链接引用,你做你的主页的顶部。

All I have are references to these libraries, script/link references as you do on the top of your master page.

这是荒谬的,我怎么解决这个问题?

This is ridiculous, how do I fix it?

推荐答案

如果你的脚本是在一个单独的脚本文件(.js文件),那么你可以只用F9就行设置一个断点。

If your script is in a separate script file (.js), then you can just use F9 to set a breakpoint on a line.

您不能设置一个断点,如果脚本是像一个aspx文件的另一个文件中。对于这样的情况下,使用调试器。 JavaScript语句强行突破在一定的点

You can't set a breakpoint if the script is incorporated in another file like an aspx file. For cases like that, use the debugger; javascript statement to force a break at a certain spot.

另外,还要确保你正在使用你的JavaScript文件的最新版本,如果有必要做一个按Ctrl-F5在IE中强制文件的一个新的重载。

Also make sure that you are working with the latest version of your javascript file, do a Ctrl-F5 in IE if necessary to force a fresh reload of the file.

这篇关于如何设置在Visual Studio 2008或Visual Studio 2010中的JavaScript断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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