views:

61

answers:

2

I have a button in aspx. In its onclientclick I called a javascript function which is written in JScript.js. Following is my javascript:

function ChangeBG()
{
   alert("hi");
}

I called this above function in button click. I had put breakpoint in javascript. But onclicking on button, alert is coming, but control is not going to breakpoint. What may be the reason for this? I am running in Internet browser. What change i can make to bring the focus to breakpoint. Can anybody help?

+2  A: 

Before alert("hi"); put the stmt debugger;

ChangeBG() 
{
  debugger; 
  alert("hi"); 
}

Your control will come to debug when you are in debug mode. This problem occurs when javascript is in a separate js file.

ThatDotNetGirl
Isn't the keyword "debugger", not "debug"?
Frank Rosario
Thanks Frank ... Extremely sorry abt the mistake.
ThatDotNetGirl
Nice bugger eh?
Binoj Antony
+1  A: 

Also do this to enable debugging in your IE browser Go to

Tool-->Internet Options-->Advanced

Uncheck - Disable script debugging ( Internet Explorer )

rahul