Welcome to WebmasterWorld Guest from 54.197.156.64

Forum Moderators: open

Message Too Old, No Replies

unterminated string literal

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

Preferred Member

10+ Year Member

joined:Dec 8, 2004
posts:500
votes: 0


Hi,

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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 3, 2005
posts:1585
votes: 0


A line line between the two paragraphs maybe ?
7:41 am on Jan 4, 2009 (gmt 0)

Administrator

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

joined:Aug 10, 2004
posts:10684
votes: 33


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)

Preferred Member

10+ Year Member

joined:Dec 8, 2004
posts:500
votes: 0


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

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members