I have a javascript that writes breadcrumbs based on the browser location pathname as follows:
[CODE] function breadcrumbs(sClass, sDelimiter)
{
if(!sDelimiter) sDelimiter = ‘>>’;
var sURL = (location.pathname.indexOf(‘?’) != -1) ? location.pathname.substring(0, location.pathname.indexOf(‘?’)) : location.pathname;
sURL = (location.pathname.charAt(0) == ‘/’) ? location.pathname.substring(1) : location.pathname;
var aURL = sURL.split(‘/’);
if(aURL)
{
var sOutput = ‘<a href=”/”>Home</a> ‘ + sDelimiter + ‘ ‘;
var sPath = ‘/’;
for(var i = 0; i < aURL.length; i++)
{
sPath += aURL[i] + ‘/’;
sOutput += ‘<a href=”‘ + sPath + ‘”‘;
if(sClass) sOutput += ‘ class=”‘ + sClass +'”‘;
sOutput += ‘>’ + aURL[i] + ‘</a>’;
sOutput += ‘ ‘ + sDelimiter + ‘ ‘;
}
sOutput += document.title;
document.write(sOutput);
}
}
It works great but I would like to be able to specify an individual URL for “home”, which also happens to be a subdirectory. So for instance, my website is: [url]http://biology.college.edu[url]http://www.college.edu/biology/
Secondly, I’ve noticed that if I’m using the breadcrumbs on an index.html file of a directory (lets say ‘faculty’), then it shows up as “Home >> faculty >> >> page title” …. I’d prefer the output to be “Home >> faculty” if possible. Where would I make these 2 changes? I tried but I farked it all up.
Thanks!!!