如何在Visual Studio 2008的.ASPX页面中的Javascript代码中使用断点 [英] How to use breakpoints in Javascript code in .ASPX page of Visual Studio 2008

查看:109
本文介绍了如何在Visual Studio 2008的.ASPX页面中的Javascript代码中使用断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.aspx设计源页面中有Javascript。我如何设置断点并运行,因为我为.cs页面设置它。我正在使用Visual Studio 2008进行编码。

我浏览了调试器的用法。但我无法得到如何正确使用它。如果是调试器;使用,有人可以详细说明它的使用方式。

I have Javascript in my .aspx design source page. How can i set breakpoints and run as i set it for a .cs page. I am using Visual Studio 2008 for my coding.
I have browsed for the use of debugger. But i couldn't get how to use it properly. If debugger; is used, can someone elaborate on how its used.

推荐答案

如果您的脚本位于单独的脚本文件(.js)中,那么您可以使用F9来设置一行上的断点。



如果脚本被合并到另一个文件(如aspx文件)中,则无法设置断点。对于这样的情况,使用调试器; java脚本语句强制在某个地方休息。

例如



JavaScript

---- ---------

for(i = 1; i< 5; i ++){

//将i打印到输出窗口。

Debug.write(" loop index is" + i);

//等待用户恢复。

调试器

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

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

JavaScript
-------------
for(i = 1; i<5; i++) {
// Print i to the Output window.
Debug.write("loop index is " + i);
// Wait for user to resume.
debugger
}


我应该将任何进程附加到文件吗?
Should i attach any process to the file ?


这篇关于如何在Visual Studio 2008的.ASPX页面中的Javascript代码中使用断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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