Passing Javascript variable to href
<p>I need to pass a variable containing the name of a picture contained in an array, this is how it looks like:</p>

<pre><code>xhttp=new XMLHttpRequest();
// alert("step 1");
xhttp.open("GET","xml/emp2.xml",false);
} 
xhttp.send("");
xmlDoc=xhttp.responseXML;
var TestP = new Array();

TestP[n] = xmlDoc.documentElement.childNodes[n].textContent;
var img = document.createElement('img');
img.src = url="pic/"+ TestP[n];
</code></pre>

<p>The images are in a folder called pic, and the name is obtained by storing it in img.src, and I want it to pass in the url. How to do this?</p>

<p>My HTML snippet :</p>

<pre><code>&lt;a href="pic/'img.src'" rel="shadowbox" onClick="OpenNewWindow(1,800, 600)"&gt;Part 1&lt;/a&gt;&lt;/li&gt;
</code></pre>
