debugging javascript code

P

pintu

Hello Everybody.
I hav some javascript code inside .net for validation and other
purpose..How can i step by stepwise debug these javascript codes inside
..net without using alert() .Any body plz help me replying this..

thanks
priyabrata
 
M

Mark Rae

I hav some javascript code inside .net for validation and other
purpose..How can i step by stepwise debug these javascript codes inside
.net without using alert() .Any body plz help me replying this..

Assuming you're using Microsoft Internet Explorer:

1) In IE, click Tools, Internet Options, Advanced

2) In the Advanced section, make sure Disable Script Debugging (Internet
Explorer) is NOT checked, and Display a notification about every script
error IS checked.

3) In Visual Studio.NET, set a breakpoint in your JavaScript just like you
would in server-side code

4) Hit F5

N.B. if this doesn't work for some reason, use the JavaScript debugger;
method e.g.

function testValidation()
{
debugger;
// rest of code
}
 
L

Laurent Bugnion

Hi,
Hello Everybody.
I hav some javascript code inside .net for validation and other
purpose..How can i step by stepwise debug these javascript codes inside
.net without using alert() .Any body plz help me replying this..

thanks
priyabrata

Additionally to Mark's explanations: If you have IE open already, you
can also choose Visual Studio's menu "Debug / Attach to process", and
then select the instance of IE in which your script is running. In case
a dialog pops up (VS2003) then select "Script" as language to debug. I
find this method to debug faster and more convenient than selecting F5.

Note that you can very well debug JavaScript and ASP.NET parallelly, by
attaching to ASP.NET process too. This is very useful when you debug web
services for example.

To be complete, note that you can also debug JavaScript in Mozilla based
browsers by using Venkman (Google for it).

HTH,
Laurent
 

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

Top