How can I escape single-quotes in Javascript?
<p>I'm using the following script on my site (<a href="http://www.xeasycorex.net" rel="nofollow">http://www.xeasycorex.net</a>) for a Tumblr button in each post. The <code>strPostTitle.replace</code> line escapes any double-quotes, but I need to do the same for single-quotes as it's terminating the string when present in post titles and not displaying the button, I'm just not sure how to do this</p>

<p>Thanks!</p>

<pre><code>&lt;script&gt;
var strPostUrl = "&lt;data:post.url/&gt;";
var strPostTitle = '&lt;data:post.title/&gt;';
var strNewUrl = strPostUrl.replace("http://","");
var strNewTitle = strPostTitle.replace(/"/g, '"');
document.write("&lt;a href='http://www.tumblr.com/share/link?url="+strNewUrl+"&amp;amp;name="+strNewTitle+"'&gt;&lt;img src='https://lh4.googleusercontent.com/-Vw74mICSigg/USjO29GAujI/AAAAAAAARHE/dY0nzXtwTVU/s81/tumblr-share.png'/&gt;&lt;/a&gt;");
&lt;/script&gt;
</code></pre>
