homepage Welcome to WebmasterWorld Guest from 50.19.33.5
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
unterminated string literal
dmmh




msg:3818722
 2:24 am on Jan 4, 2009 (gmt 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]

 

daveVk




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

A line line between the two paragraphs maybe ?

phranque




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

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.

dmmh




msg:3818817
 10:10 am on Jan 4, 2009 (gmt 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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved