How do I replace the image of a specific class name?
<p>I am trying to write a script which will select each of the elements with the class name "mainlogo-img" and replace the image source with the file I've indicated. For some reason, this isn't working. Am I writing this script incorrectl</p>

<pre><code>&lt;script type="text/javascript"&gt;
pageLoc = location;
if (pageLoc == "http://www.barflypub.com/drinks/") {
    logoBox = document.getElementsByClassName("mainlogo-img")
for (i = 0; i &lt; logoBox.length; i++) {
logoBox[i].src = "http://www.barflypub.com/wp-content/gallery/default/img_0962.jpg";
}
&lt;/script&gt;
</code></pre>
