The section is foo.com/agriculture. It has a banner image corresponding to the name in the javascript. I need the internal page foo.com/agriculture/harvest to have a separate banner than the foo.com/agriculture. The script I am working with for the banner swap for each page is as follows:
<script type="text/javascript">
var dir = location.pathname.split("/")[1];
//var dir2 = location.pathname;
if (dir == "agriculture")
document.write('<IMG SRC="/images/ib_agriculture.jpg" WIDTH=1024 HEIGHT=91 BORDER=0>')
else if (dir == "showcase")
document.write('<IMG SRC="/images/ib_show.jpg" WIDTH=1024 HEIGHT=91 BORDER=0>')
else if (dir == "contact")
document.write('<IMG SRC="/images/ib_contact.jpg" WIDTH=1024 HEIGHT=91 BORDER=0>')
else if (dir == "distribution")
</script>
I tried the following different codes to try and assign the internal page foo.com/agriculture/harvest a separate banner.
var dir = location.pathname.split("/")[1];
//var dir2 = location.pathname;
if (dir == "agriculture/harvest")
document.write('<IMG SRC="/images/ib_agriculture_harvest.jpg" WIDTH=1024 HEIGHT=91 BORDER=0>')
else if (dir == "showcase")
var dir = location.pathname.split("/")[1];
//var dir2 = location.pathname;
if (dir == "harvest")
document.write('<IMG SRC="/images/ib_agriculture_harvest.jpg" WIDTH=1024 HEIGHT=91 BORDER=0>')
else if (dir == "showcase")
Both of the scripts above continue to grab the foo.com/agriculture banner (ib_agriculture.jpg) instead of the called foo.com/agriculture/harvest (ib_agriculture_harvest.jpg). I am not sure how to get the script to call the appropriate banner per page.