View Single Post
Old 11-29-2007, 04:28 PM   #1 (permalink)
fini
DNF Newbie
 
Last Online: 03-08-2008 07:47 AM
iTrader: (0)
Join Date: Sep 2004
Posts: 29
DNF$: 113


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
fini is offline   Reply With Quote