Inserting class of clicked element and ID of parent into another image
<p>I'm a JavaScript novice and I'm having some difficulty getting my code to work. I've set up a function that pulls in variables based on element classes and IDs and executes it onclick.</p>

<p></p>

<pre><code>&lt;div id="holder"&gt;
    &lt;img id="wallImg" src="/testpath/selwall/nopaint.jpg"&gt;
&lt;/div&gt;

&lt;div id="options"&gt;
    &lt;ul id="selWall"&gt;
        &lt;li class="bluepaint" onclick="printStuff()"&gt;&lt;strong&gt;Blue&lt;/strong&gt;&lt;/li&gt;
        &lt;li class="redpaint" onclick="printStuff()"&gt;&lt;strong&gt;Red&lt;/strong&gt;&lt;/li&gt;
        &lt;li class="greenpaint" onclick="printStuff()"&gt;&lt;strong&gt;Green&lt;/strong&gt;&lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;

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

    function printStuff() {

        var imgCategory = srcElement.parentNode;
        var imgClass = srcElement.className;

        document.getElementById("wallImg").src="http://testurl.co.uk/media/gbu0/" + imgCategory + ImgClass + ".png";

    }

&lt;/script&gt;
</code></pre>

<p></p>

<p>The user is supposed to be able to select their paint colour from a selection of swatches (the ul#selWall li elements) and the JS will change the source of a particular image ID on the page (in this case, img#wallImg) with the clicked element's class and clicked element's parent element ID.</p>

<p>Eventually I want to be able to expand this script to use the ul id as a URL parameter name and the paint type (i.e. <code>testurl.com/paint-selection&amp;selWall=bluepaint&amp;selDoor=greenpaint</code>.) As far as I know, JQuery is unable to append URLs so I'd rather stick with plain JavaScript.</p>