| changing an image based on page title Hi,
I want to change the source of an image depending on the page title i.e. boats.html would show boats.jpg and car.htm would show car.jgp. I'm guessing some sort of javascript would be in order, but haven't got a clue really. Could anyone suggest anything?
worked it out:
<script language="JavaScript">
<!--
function setimage()
{
var picsource = document.URL.split('/').pop().split('.').shift();
var str=picsource +'.jpg';
document.images['monthimage'].src=str;
}
</script>
Last edited by fini; 11-29-2007 at 04:33 PM.
Reason: Automerged Doublepost
|