In the question Why will Visual Studio 2005 not debug my javascript? I learned that debugging is possible in Visual Studio 2005 but you have to start debugging your application and then press CTRL-ALT-N to open the Script Explorer to set break points, etc.
However, even with the following simple code, when I press CTRL-ALT-N, the Script Explorer window is totally blank. According to all the articles I have found on the subject, it should have e.g. in my case ‘main.js’ (I imagine it is like debugging in Firebug) but it is blank.
What else do I have to do to Visual Studio 2005 so that the Script Explorer shows my running javascript files?
Default.aspx:
<%@ Page Language='C#' AutoEventWireup='true' CodeBehind='Default.aspx.cs' Inherits='TestJavascriptDebugging2005._Default' %> <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> <html xmlns='http://www.w3.org/1999/xhtml' > <head runat='server'> <script type='text/javascript' src='javascript/main.js'></script> </head> <body> <form id='form1' runat='server'> <div> <p>This is HTML and <script type='text/javascript'>test()</script>.</p> <p><button onclick='doIt(this)'>Test</button></p> </div> </form> </body> </html>
javascript/main.js:
function test() { document.write('this is from javascript code2'); } function doIt(element) { alert('This is the javascript function2.'); }
Try attaching your Visual Studio to MSIE via Debug > Attach to process (not sure if it is there in VS2005, look around).
When attaching to process make sure that you check script option.