Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Compiler errors in commented JavaScript code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard - 29 Mar 2008 18:07 GMT
Hi,

I removed some functionality from an ASP.NET 2 webpage by deleting the input
ior textbox control from the page's code. Then I commented out the JavaScript
function on the same page that referenced the deleted control, so the
commented function looks like this:

/*
function MyFunction()
{
}
*/

I'm puzzled why the compiler gives me an error in a line of code that's
inside the commented function, and references the deleted control. It
complains b/c the control doesn't exist... But the code is commented out! Do
you know why does this happens?

Thanks in advance,

Rick
Just Me - 29 Mar 2008 18:33 GMT
You will probably find that you have missed out a semicolon or brace
somewhere else in the code, this is obviously bogus as an error message in
that respect.

> Hi,
>
[quoted text clipped - 20 lines]
>
> Rick
Richard - 29 Mar 2008 20:32 GMT
But the coloring code of Visual Studio shows the function in commented-out
color, then whatever is inside the function should be dismissed by the
compiler.
Also, if some semicolon or brace was missing from other code, how comes
there was no error or warning before commenting the JS function?
I've seen the ASP.NET JS debugger stepping thru commented-out JS code, and I
wonder why? Have anyone else experimented this?

> You will probably find that you have missed out a semicolon or brace
> somewhere else in the code, this is obviously bogus as an error message in
[quoted text clipped - 24 lines]
> >
> > Rick
Just Me - 29 Mar 2008 21:39 GMT
I tried. I cant set a break point on the commented code, nor can I
replicated your problem. You may have some corruption in the symbols
datatbase. Delete the debug stuff and rebuild it.

> But the coloring code of Visual Studio shows the function in commented-out
> color, then whatever is inside the function should be dismissed by the
[quoted text clipped - 35 lines]
>> >
>> > Rick
Ben Amada - 30 Mar 2008 06:43 GMT
> But the coloring code of Visual Studio shows the function in commented-out
> color, then whatever is inside the function should be dismissed by the
[quoted text clipped - 4 lines]
> I
> wonder why? Have anyone else experimented this?

I recently saw a problem in VS2005 where a block of HTML was commented out
with the standard <!-- and --> marks.  Within the commented out HTML, there
were other HTML comments documenting some of the commented out HTML.  In
VS2005, the entire commented out block was green and IE7 was ignoring the
commented out block.  However, Firefox was not ignoring some of the
commented out HTML.  The W3 validator also appeared to be treating some of
the commented out HTML as though it was not commented out.

To fix the problem, I removed the "embedded" HTML comment marks so in the
end, I only had one beginning comment out mark and one ending comment mark.
This might not be the same problem you're seeing.  I just wanted to mention
this because it does seem possible that Visual Studio may show some code as
commented out via its green font, but another program (the JS debugger or
another browser) may not treat the code as commented out.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.