Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

unterminated string literal



2:24 am on Jan 4, 2009 (gmt 0)

10+ Year Member


I know what the error means, but I just can't spot where it's occuring and Firebug isn't much of a help either...

could you try to spot it for me?

<a href="#" onClick="insertText('<p>Lorem ipsum text text text <a href=&quot;http://www.example.com/support/download_details.jsp?id=209&quot;>text text</a> text text.</p>
<p>text, text &quot;text&quot; text. Text &quot;text&quot;. Text, text &quot;Text&quot; text &quot;text&quot; text &quot;text&quot; text.</p>');">Text, text: "text".</a>

the javascript function itself works fine, just not for some type of text, this specific part of text, which needs to be inserted into a textarea when a user clicks on a link, apparently contains something which borks up the javascript....help?

[edited by: coopster at 10:12 pm (utc) on Jan. 4, 2009]
[edit reason] generalized domain and text [/edit]


4:39 am on Jan 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

A line line between the two paragraphs maybe ?


7:41 am on Jan 4, 2009 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

my guess is the closing </a> tag in the quoted string should be encoded.
try using the &lt; and &gt; html entities for all the tags in the quoted string.


10:10 am on Jan 4, 2009 (gmt 0)

10+ Year Member

thanks people, it indeed had to do with a carriage return....

been bugging me for hours!
since the string came out of PHP, I just stripped it all like:

$text = str_replace(chr(13), " ", $text); //remove carriage returns
$text = str_replace(chr(10), " ", $text); //remove line feeds


Featured Threads

Hot Threads This Week

Hot Threads This Month