我无法在Studio中使用Javascript的断点。如果我使用调试器,我可以调试;
我已经看到了这个问题Breakpoint not hooked up when debugging in VS.Net 2005。我尝试了答案但没有用。
查看模块窗口,正确加载V.Mvc.Jobtrakt.PDB,但它指向临时文件夹 C:\ WINDOWS \ Microsoft.NET \ Framework \ v2.0.50727 \ Temporary ASP.NET Files \ root \ dbc0c0c5 \ f64a99b3 \ assembly \ dl3 \ 9de055b3 \ eb1303b1_9760c901 \ V.Mvc.Jobtrak.pdb:已加载符号。
我原以为它会指向: \ JobTrak \ Website \ V.Mvc.Jobtrak \ V.Mvc.Jobtrak \ _ obj \ Debug(这是在项目目录中)
但无论位置如何,我都关闭了VS 2008,然后吹走了临时文件夹(上面列出的),bin和obj文件夹。
打开VS 2008并干净利落。我在js中设置了一个断点,看起来它现在可以正常工作(断点被填入) 开始调试,它永远不会在断点上中断。看看断点,它现在是一个带有红点和警告指示的红色圆圈。将鼠标悬停在断点上会给我一些有用的信息:断点当前不会被击中。该位置无法映射到客户端脚本。请参阅ASPX断点映射的帮助。我没有被重定向,断点与函数有关。等等,这应该有效。
所以我想知道是否有人有任何想法? 有人能够在VS2008中设置断点并让它们工作吗?
答案 0 :(得分:15)
尝试在要破解的来源中键入“调试器”
答案 1 :(得分:5)
确保您已接受正确的流程。例如,一旦您在IE中加载了您的页面,
看看是否有助于调试javascript。
答案 2 :(得分:1)
这也发生在我身上。断点停止在某些功能中起作用。就我而言,问题是我在脚本中使用了<%=..%>
。据我所知,读取MSDN会发生这种情况,因为Visual Studio会根据行内容将断点行从.ASPX
映射到生成的HTML,因此当您放置<%=..>
生成的脚本时与.ASPX
文件中的不同。
答案 3 :(得分:1)
你不应该把调试器放在javascript中。我发生了这种情况,原因是try语块中的脚本在语法方面存在错误。一旦修复了语法,断点就会再次正确映射。
答案 4 :(得分:0)
格雷格回答了这个问题,但只是为了增加一些价值来回答 -
将调试器放在java脚本代码中。
同时确保您在Internet Explorer中启用了调试器&gt;工具&gt;互联网选项&gt;预先
不应检查禁用调试的复选框。
答案 5 :(得分:0)
在我的情况下,我应该使用
$。AJAX({ 输入:“GET”,
代替 $就({ 键入:“POST”,...
答案 6 :(得分:-1)
只需在脚本中为每行或任何行键入警报功能,如果未触发警报,则我们可以识别出错误的行
<script type="text/javascript">
$(function() {
//event handler to the checkbox selection change event
$("input[type=checkbox]").change(function() {
//variables to store the total price of selected rows
//and to hold the reference to the current checkbox control
var totalPrice = 0, ctlPrice;
//iterate through all the rows of the gridview
$('#Grid2 tr').each(function() {
//if the checkbox in that rows is checked, add price to our total proce
alert("Hi")
if ($(this).find('input:checkbox').attr("checked")) {
ctlPrice = $(this).find('[id$= lblPackAmount]');
//since it is a currency column, we need to remove the $ sign and then convert it
//to a number before adding it to the total
totalPrice += parseFloat(ctlPrice.text().replace(/[^\d\.]/g, ''));
}
});
//finally set the total price (rounded to 2 decimals) to the total paragraph control.
//alert(totalPrice);
$('#lblAmount').text(totalPrice);
});
});
</script>