Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unterminated string constant ??? 3

Status
Not open for further replies.

PhatH

IS-IT--Management
Mar 30, 2004
88
US
Hello all,

i got this ERROR: "unterminated string constant" from a page and I pretty sure that comes from a Javascript code using for a pulldown rollover links. The links were pulling down fine until this morning, out of nowhere, they all dead, no pulling down anymore. An addition to that, I got the ERROR I mentioned on the above.

Have anyone seen the ERROR before? The line# the ERROR pinpoint to is not in the page, "line number is out of range".

Thanks!
 
unterminated string constant" means that there is a quote or double-quote that does not have a mate. It happens often enough. Especially after you change your code. The line number may not be near where the missing quote mark is because it is kind of hard to calculate where it should be.

If you have Netscape use it to debug Javascript by typing javascript: in the location field.

If this error is in a CGI, ASP, or PHP page, good luck.

Internet Explorer tends to display pages from cache even after you have modified them. That could account for the apparent morning failure.

Are you the only one coding the pages that failed? If so, you stand a fighting chance of finding where the missing quote mark should be, it will be near your last change.
 
When looking for a particular line number in JavaScript, make sure you take into account the number of lines in any external scripts you may be calling. It still may not be completely accurate, but it may help get you looking in the right area.

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
This sure is a common error... I have found this happening in cases where the data is being fed to the java script like a name for e.g. Mark Kelly works fine but as soon as it’s Mindy O'Grady it crashes... the single quote is the culprit… as the variable assignment may be as follows:
Var uName = ‘Mr. <%=userBean.getUserName()%>’

Solution is to identify all such special characters in your data and handle them accordingly.

Cheers!
Roy
 
To elaborate on what adam said, if you check the 'view source' of your page, that will always reflect the correct line number. (Rather than looking thru your server side code)

-kaht

banghead.gif
 
If you go the 'View Source' route, make sure to take 'Word Wrap' off. I've got Windows 2000 and my Notepad is what opens when I 'View Source'. I can use CNTL-G and type in a line number and I'll go straight there, but if 'Word Wrap' is on, the numbering is usually way off.

--Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top