Passing variable from javascript to href
<p>I have a variable in javascript that contains the directory of an image.
I want to pass it to an href 
how to do this?</p>

<pre><code>    function OpenNewWindow(n, width, height)
    {
          if( navigator.appName == "Microsoft Internet Explorer"){
            xhttp=new ActiveXObject("Microsoft.XMLHTTP");
            xhttp.open("GET","http://www.multimediaprof.com/test/emp2.xml",false); 
            }
        else if(navigator.appName == "Netscape"){

        xhttp=new XMLHttpRequest();
        // alert("step 1");
        xhttp.open("GET","xml/emp2.xml",false);
        } 
        xhttp.send("");
        xmlDoc=xhttp.responseXML;

var imageName = xmlDoc.documentElement.childNodes[n].textContent;
TestP[n] = imageName;
alert(TestP[n]);
var img = document.createElement('img');
img.src = "pic/" + imageName;
alert(img.src);
return img.src;

&lt;li&gt;&lt;a href="javascript:OpenNewWindow(1,000,000);alert('clicked!');" rel="shadowbox" "&gt;Part 0&lt;/a&gt;&lt;/li&gt;
</code></pre>

<p>The variable img.src contains the path, and i want to  pass it to the href</p>
