469,344 Members | 6,266 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,344 developers. It's quick & easy.

Unterminated String constant in JS

in IE only I am getting an "Unterminated String constant" when running a script.

The error states line 20072 char 62.

I have looked on this line and cannot see why it would throw this error? -

The page can be found at the link, I would post the code but it is very large!

http://www.nctfleetlist.co.uk/search_result.php?
Feb 9 '12 #1

✓ answered by Dormilich

that’s correct, JavaScript’s strings are not multiline (except when you manually escape the newline).

Expand|Select|Wrap|Line Numbers
  1. // invalid
  2. var mystring = "1 2 3
  3. 4 5 6";
  4.  
  5. // valid
  6. var mystring = "1 2 3" +
  7. "4 5 6";
  8. // also valid
  9. var mystring = "1 2 3\
  10. 4 5 6";

2 1749
Dormilich
8,652 Expert Mod 8TB
that’s correct, JavaScript’s strings are not multiline (except when you manually escape the newline).

Expand|Select|Wrap|Line Numbers
  1. // invalid
  2. var mystring = "1 2 3
  3. 4 5 6";
  4.  
  5. // valid
  6. var mystring = "1 2 3" +
  7. "4 5 6";
  8. // also valid
  9. var mystring = "1 2 3\
  10. 4 5 6";
Feb 9 '12 #2
Thanks a lot, had a feeling it would've been something I had overlooked!

:)
Feb 9 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by noViagraHere | last post: by
2 posts views Thread by polilop | last post: by
5 posts views Thread by ken s | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.