Breakpoint in jscript not being hit

  • Thread starter Thread starter teddysnips
  • Start date Start date
T

teddysnips

In the past I've used the "debugger;" statement with great effect to
debug client-side JScipt.

Since I moved to Vista I've been having problems. The project is
VS2003 so I've got a dual-boot XP, which I'm currently running.
However, when I put the "debugger;" into my code, the breakpoint is
not at the "debugger;" statement but at the end of the previous form.
For example, it's not here:

// This is a form called SearchPeople.aspx
document.all.item("Form1").onsubmit=fubar;
function fubar() {
debugger; <-- NOT HERE
getE('cmdFilter').style.visibility = "hidden";
window.status = "Please wait...";
document.title = window.status;
document.all.item("Form1").style.cursor = "wait";
}

but here

//This is a form called logon.aspx
//-->
</script>
</body>
</HTML>
<-- this is where the yellow pipe shows up

If I press F8 to step into the next statement it goes into a
completely unrelated jscript function library. Note that the function
"fubar" is called on the form's "onsubmit", which is triggered by
pressing an Image button. If I keep stepping through the code it
eventually returns to the form, although the code in fubar is not run
(i.e. the control cmdFilter is not set to invisible as at line:

getE('cmdFilter').style.visibility = "hidden";

What really "bugs" me about this is that if I then REMOVE the line
"debugger;" and run the code, it STILL hits that breakpoint. If I
then run without debugging (CTRL + F5) then the form loads correctly
but when I press the Imagebutton to call the fubar function, I get a
"Just-In-Time Debugging" window informing me that "An exception
'Runtime error' has occurred in script" and inviting me to select a
debugger. If I select the currently running version of VS 2003,
though of course it's pointing at the wrong .aspx file and loads
logon.aspx as above.

Any thoughts, anyone? I've deleted all the .dll and .pdb files
several times.

Thanks

Edward
 
you probably have other javascript code throwing the error. i'd switch to
firefox/firebug which has better debugging, but you'd need to convert your
script to w3c standard (you will want to do this for ie 8.0 anyway or you
will have to run in non-standard mode)

-- bruce (sqlwork.com)
 
you probably have other javascript code throwing the error. i'd switch to
firefox/firebug which has better debugging, but you'd need to convert your
script to w3c standard (you will want to do this for ie 8.0 anyway or you
will have to run in non-standard mode)

-- bruce (sqlwork.com)

This won't work, I'm afraid - it's legacy code and there's no budget
for conversion such as you suggest. I just need to get debugging
working as it used to - any other ideas?

Thanks

Edward
 
Back
Top