Get URL to current background-image and hand over to <a href>
<p>I have an issue i couldn't figure out so far. I googled and searched here, found some answers, but I can't get it to work.</p>

<p>I want to figure out the current background image from css and create a link to download the image.</p>

<p>This is my simplyfied code so far:</p>

<pre><code>&lt;style type="text/css"&gt;
body.custom-background { background-image: url('http://localhost:8888/wp-content/uploads/2012/04/bg2.jpg'); background-repeat: no-repeat; background-position: top center; background-attachment: scroll; }
&lt;/style&gt;

&lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;

&lt;script type="text/javascript"&gt;

var image = body.custom-background.css('background-image').replace(/^url\((.*?)\)$/,     '$1');
document.getElementById('link').setAttribute("href",image);


&lt;/script&gt;

&lt;div id="hide"&gt;
    &lt;a id="hidepage"&gt;hide page&lt;/a&gt;
    &lt;a id="showpage" style="display:none;"&gt;show page&lt;/a&gt;
&lt;/div&gt;

&lt;div id="downloadbg"&gt;

    &lt;a id="link"&gt;&lt;br&gt;Download Background&lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>I am pretty new to programming and I am running out of ideas.</p>

<p>Thank you very much for your help.</p>
