Yesterday I posted a message about a problem hitting a breakpoint when
debugging Javascript in VS2003.
Today I've found out what the problem is. I created a new VS2003 web
solution with a single aspx page, with three controls - a text box, a
check box and a submit button. I put the following code in the page:
<script language="javascript" id="Custom">
<!--
// Get document element
function getE(id) {
return document.getElementById(id);
}
document.all.item("Form1").onsubmit=fubar;
function fubar() {
getE('txtMyText').value = "hidden";
}
Everything worked fine UNTIL I set the AutoPostBack property of the
check box to "True". When I looked in the Running Documents for the
rendered HTML, it turns out that the
function __doPostBack(eventTarget, eventArgument)
code block is NOT showing in the Running Documents, despite being in
the View Source. So, naturally, when you try to set a breakpoint in
code BELOW the __doPostBack the poor old debugger can't associate the
line with executable code.
Further digging reveals that this problem exists for VS2003 and IE7.
I'm just going to have to try to roll back to IE6. What a crock.
Edward
Mark Rae [MVP] - 18 Mar 2008 14:04 GMT
> <script language="javascript" id="Custom">
That's deprecated syntax, and should be avoided - use this instead:
<script type="text/javascript" id="Custom">

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
teddysnips@hotmail.com - 19 Mar 2008 00:05 GMT
> <teddysn...@hotmail.com> wrote in message
>
[quoted text clipped - 5 lines]
>
> <script type="text/javascript" id="Custom">
This change makes no difference at all. Breakpoint not hit. Cannot
debug under IE7 when running VS2003. Pants.
Edward
Mark Rae [MVP] - 19 Mar 2008 00:38 GMT
>>> <script language="javascript" id="Custom">
>>
[quoted text clipped - 4 lines]
> This change makes no difference at all. Breakpoint not hit. Cannot
> debug under IE7 when running VS2003. Pants.
I was merely pointing out that you were using out-of-date JavaScript
syntax...

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
bruce barker - 19 Mar 2008 05:50 GMT
install vs2008 and use it to debug script. turn the script debug off on
vs2003, then attach to ie7 with vs2008.
-- bruce (sqlwork.com)
>> <teddysn...@hotmail.com> wrote in message
>>
[quoted text clipped - 9 lines]
>
> Edward
bruce barker - 18 Mar 2008 16:29 GMT
while asp.net 1.0/1.1 rendered the __doPostback in the source, version 2.0
(vs2005) the code is in a resource file referenced as a javascript include.
also as asp.net may attached code to the onsubmit, your code may cause
errors. you should do something like:
var frm = document.getElementById('Form1');
frm.oldOnSubmit = frm.onsubmit;
frm.onsubmit = function() {fubar(); if (this.oldOnSubmit)
this.oldOnSubmit(); };
-- bruce (sqlwork.com)
> Yesterday I posted a message about a problem hitting a breakpoint when
> debugging Javascript in VS2003.
[quoted text clipped - 31 lines]
>
> Edward
teddysnips@hotmail.com - 19 Mar 2008 00:04 GMT
On Mar 18, 3:29 pm, bruce barker
<brucebar...@discussions.microsoft.com> wrote:
> while asp.net 1.0/1.1 rendered the __doPostback in the source, version 2.0
> (vs2005) the code is in a resource file referenced as a javascript include.
[quoted text clipped - 8 lines]
>
> -- bruce (sqlwork.com)
It's VS2003, and not likely to change anytime soon.
Edward
Mark Rae [MVP] - 19 Mar 2008 00:36 GMT
> It's VS2003, and not likely to change anytime soon.
Mainstream support for VS2003 will expire in under six months:
http://support.microsoft.com/lifecycle/search/?sort=PN&alpha=Visual+Studio+.NET+
2003&Filter=FilterNO
After that, unless you can afford an extend support contract, you're
essentially on your own...

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net