Unterminated string constant error
We just dicovered a bug in our app that returns this error. When going to a certain page in our ASP.NET 2.0 app. When I press "Yes" to debug, the source of 开发者_运维百科the page is displayed, but the line that is referenced has NO Java script on it. I am trying to figure what maybe causing the issue and how to debug it. This is IE only application. The bug is happening in IE7 and 8. Any pointers appreciated.
Thanks.
Internet Explorer is famous for accumulating line numbers by a system of its own (it uses the total of all lines in all files or something). Use Firefox and its error console to get correct line numbers.
What debugger are you using? You can always try opening the page in Firefox with Firebug enabled or in IE8 go to Developer Tools | Script | Start Debugging.
I would guess that the line number is not the line number of the aspx file, but the line number inside the script block, which may then be in another file in case the offending code is located in an external javascript file.
Can you give us more information about the error?
- What action is done that results in the error? (button click, etc.)
- How are you adding JavaScript to the page? (external files, in the head section, etc.)
- Can you Show us some of your code?
Here is what I would do if I were there to help you (looking at your code):
I would look at what happens just before the error. I would determine based on that what JavaScript function is being run. I would look then for any variables that contain the string termination character (either ' or " depending on how the string starts).
Without seeing some code, we probably wont be able to help all that much.
It turned out to be caused by another developer's fix to a bug. The actual error was inside a user control that was on a page.
Thanks for the help!
精彩评论