PC Review


Reply
Thread Tools Rate Thread

Breakpoint in jscript not being hit - answer but no solution

 
 
teddysnips@hotmail.com
Guest
Posts: n/a
 
      18th Mar 2008
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
 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      18th Mar 2008
<(E-Mail Removed)> wrote in message
news:6ac62af2-70ba-47a9-a2d4-(E-Mail Removed)...

> <script language="javascript" id="Custom">


That's deprecated syntax, and should be avoided - use this instead:

<script type="text/javascript" id="Custom">


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

 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      18th Mar 2008
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)


"(E-Mail Removed)" wrote:

> 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
>

 
Reply With Quote
 
teddysnips@hotmail.com
Guest
Posts: n/a
 
      18th Mar 2008
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..
>
> 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)


It's VS2003, and not likely to change anytime soon.

Edward
 
Reply With Quote
 
teddysnips@hotmail.com
Guest
Posts: n/a
 
      18th Mar 2008
On Mar 18, 1:04*pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote:
> <teddysn...@hotmail.com> wrote in message
>
> news:6ac62af2-70ba-47a9-a2d4-(E-Mail Removed)...
>
> > <script language="javascript" id="Custom">

>
> That's deprecated syntax, and should be avoided - use this instead:
>
> <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
 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      19th Mar 2008
install vs2008 and use it to debug script. turn the script debug off on
vs2003, then attach to ie7 with vs2008.

-- bruce (sqlwork.com)


(E-Mail Removed) wrote:
> On Mar 18, 1:04 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote:
>> <teddysn...@hotmail.com> wrote in message
>>
>> news:6ac62af2-70ba-47a9-a2d4-(E-Mail Removed)...
>>
>>> <script language="javascript" id="Custom">

>> That's deprecated syntax, and should be avoided - use this instead:
>>
>> <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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Breakpoint in jscript not being hit teddysnips@hotmail.com Microsoft ASP .NET 2 17th Mar 2008 05:22 PM
Please someone answer my JScript Runtime error question. sheana Microsoft Word New Users 1 14th Jan 2008 10:56 PM
If your IE (jscript.dll) crashes on Google Video pages, here's a solution! linshunghuang@gmail.com Windows XP Internet Explorer 4 27th Dec 2006 04:41 PM
project stops at imaginary breakpoint, but no breakpoint exists Mark Microsoft ASP .NET 4 26th Apr 2004 05:23 AM
Jscript Solution for Eval Derek Hart Microsoft Dot NET Framework Forms 3 9th Jul 2003 08:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:11 PM.