Script prints the name of the variable instead of its value
<p>I'm using this script that takes an url and modifies it. It stores the new URL in a variable called #url and then it sets that variable as the href of a link.</p>

<p>It's changing the HREF however instead of printing the URL it's creating a link to the name of the variable: #url</p>

<p>This is the script:</p>

<pre><code>    if(url.match(/http:\/\//))
    {
    url = url.substring(7);
    }
    if(url.match(/^www\./))
    {
    url = url.substring(4);
    }
    url = "www.chusmix.com/tests/?ref=" + url;
    $("#output").html(url);
    $("#url").val(url).focus().select();
    var yourElement = document.getElementById('test');
 yourElement.setAttribute('href', '#url');
</code></pre>

<p>I'm trying to make it work in JSFiddle, I just tried chaning the quotes but didn't work.</p>

<p><a href="http://jsfiddle.net/Lisandro/JKxRg/4/" rel="nofollow">http://jsfiddle.net/Lisandro/JKxRg/4/</a></p>

<p>Thanks for any help</p>
