Wednesday, February 15, 2006

Debugging JavaScript using VS.NET 2003

Hi all, earlier I had seen someone debugging JS using VS.NET IDE. And it took a long time for me to find it out. And here it goes...
Before that Long Live "FireFox" and the JavaScript console it provided, without which life would have been miserable.

Now How to Debug JavaScript using VS.NET 2003?
First go to IE (again IE because it is the favourite browser of all)
Tools-->Internet Options-->Advanced and uncheck 'Disable script debugging'.
Now add "debugger" at the place from where you want to start debugging. For Eg;
function change()
{
var img; img = 1;
var path;
debugger alert(img);
path="images\\" + String(img)+ ".gif";
document.Form1.img1.src = path;
//alert(path);
}


Now run the application and there you are debugging the JS....
ps: I have called the js function onload of the body tag.

No comments: