Javascript replace for all instances
<p>I found a nice bit of code to add some 'normal' text links (i.e. rather than a button) to share a page on social media sites:</p>

<pre><code>&lt;a href="https://twitter.com/share?url=[url]"onclick="this.href = this.href.replace('[url]',window.location)" target="_blank" title="Share on Twitter"&gt;Twitter&lt;/a&gt;
</code></pre>

<p>Which works great. But for Pinterest I need the url to placed twice, for the page url and for the pin image:</p>

<pre><code>&lt;a href="http://pinterest.com/pin/create/button/?url=[url]&amp;media=[url]pin.jpg" onclick="this.href = this.href.replace('[url]',window.location)" target="_blank"&gt;Pinterest&lt;/a&gt;
</code></pre>

<p>In this case just the first url gets added.</p>

<p>Not that hot on javascript. There must be an easy way to replace all instances of [url], right?</p>
