If you have no objection to naming the page by the file's name, ie, <title>foobar</title> ...for foobar.html, then a quick and clean way of gaining the file's name would be document.write(document.title);

And if you do have an objection, then you have something to add to your "nifty javascript tricks" folder.

//Returns everything right of the last instance of the subString to the end of the fullStringfunction rightFromSubStringToEndOfFullString(fullString, subString) { if (fullString.lastIndexOf(subString) == -1) { return ""; } else { return fullString.substring(fullString.lastIndexOf(subString)+1, fullString.length); } }

//Returns everything left of the last instance of the subString to the start of the fullStringfunction leftFromSubStringToBeginningOfFullString(fullString, subString) { if (fullString.lastIndexOf(subString) == -1) { return ""; } else { return fullString.substring(0, fullString.lastIndexOf(subString)); } }

//Strip out everything before the last "/"myVar = rightFromSubStringToEndOfFullString(myUrl, mySub1);

I've enjoyed watching you perfect this script. It's the kind of thing that brings me pleasure -- I often put in ridiculous amounts of time perfecting things that already do the job, but just are not as elegant as I would like.

Thanks Tedster. I have a tendancy to write scripts, keep going with what I'm doing and then come back later to try and trim them down! However, I've got into the habit of starting with quite long, simplistic code. For me it's easier to get to a solution that way and then come back and trim, trim and trim some more!