[RESOLVED] Unterminated string literal?
Hello, everyone.
Got one that's making me scratch my head, a lot.
I keep getting an 'unterminated string literal' error message.
Code:
incJS += '<script type="text/javascript" src="' + thisRoot + 'scripts/application/FP.js"></script>';
According to FF Error Console, it exists right at the end of the </script> tag.
I'm not seeing it. What am I missing?
Thanks,
What's the line before and after, particularly before?
Great wit and madness are near allied, and fine a line their bounds divide.
Thanks for the response, Declan, but I finally figured it out; although I don't remember this ever being a problem, before.
The string was being terminated early because I was not escaping forward slashes with a backslash.
Incorrect:
incJS += '<script type="text/javascript" src="' + thisRoot + 'scripts/application/FP.js"></script>';
Correct:
incJS += '<script type="text\ /javascript" src="' + thisRoot + 'scripts\ /application\ /FP.js"><\ /script>';
Sigh
It's because of the script closing tag inside the string. When you don't escape or split it like
'<scr'+'ipt>' it's seen as the close tag of your script.
Dangit. I should have fingered that one out. Didn't even think of it. Thanks for the info.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks