How to debug client-side script (javascript) from VS2003 or VS2005?

L

Lau Lei Cheong

javascript:window.alert(document.getElementById("ctrl_id").form.id);

You'll find the above statement very useful in detecting "form deteched
controls because of improperly closed tag".

Anyway, you'll want to insert window.alert() statement everywhere when
debugging to act as breakpoint for your javascript functions.

And I also find the "Javascript Console" of Firefox very useful.
 
M

Marina

Here are 2 ways:

1. put in the 'debugger' statement. When the browser reaches this statement,
it will pop up a message box asking if you want to debug. You can then
select a new or existing instance of VS and go from there. You must have
debugging enabled in your browser and specify that you want to be notified
of every script error, or else you won't get this pop up.
2. Attach to the iexplorer.exe process that is running your page using VS.
You should be able to set breakpoints, etc.

However, as an aside, method 2 though this does sometimes work for me,
sometimes it does not. It seems to be sort of flaky, and sometimes it just
won't stop at the breakpoints. #1 is pretty reliable, but you have to
remember to remove the debugger statements when you are done
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top