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
<script type="text/javascript">
pageLoc = location;
if (pageLoc == "http://www.barflypub.com/drinks/") {
logoBox = document.getElementsByClassName("mainlogo-img")
for (i = 0; i < logoBox.length; i++) {
logoBox[i].src = "http://www.barflypub.com/wp-content/gallery/default/img_0962.jpg";
}
</script>
There’s a
}missing in the end.