[thelist] need to make changes to breadcrumb script to fit my needs

Christian Heilmann lists at onlinetools.org
Wed Jan 12 18:40:15 CST 2005


Bruce Gilbert wrote:

>Hello,
>
>I am using a js breadcrumb script that spits out links based upon the
>directory structure my files are in (they probably all do this), but I
>need to alter the code to fit my needs or find a better one. I'm not
>familiar enough with js to be able to alter it without some
>assistance.
>
>What I have in my directory structure is this: all html files>>top
>level>>sublevel>>sub_sub level etc.
>
>I want to keep all the html files in one big folder with subfolders
>for maintenance purposes. The code I have reads everything, so it will
>give me links for exactly what I have in my file structure (see
>above). I would like it to ignore the first folder (html files) and
>just give me top level>>sublevel>> sub_sublevel. It also makes the
>breadcrumb for the page you are on a link, and I would rather not have
>the current page as a link.
>
>Hopfully someone can point me in the right direction!
>
>here is my current breadcrumbs code:
>
>var path = "";
>var href = document.location.href;
>var s = href.split("/");
>for (var i=3;i<(s.length-1);i++) {
>path+="<a href=\""+href.substring(0,href.indexOf(s[i])+s[i].length)+"/\"
>title=\"Go up "+ (s.length-i-1) +" levels to
>"+s[i]+"\">"+unescape(s[i])+"</a> &gt;&gt; ";
>}
>i=s.length-1;
>path+="<a href=\""+href.substring(0,href.indexOf(s[i])+s[i].length)+"\"
>title=\"You are currently viewing this page\">"+s[i]+"</a>";
>var url = path;
>document.writeln(url);
>
>TIA!
>  
>
Well, the var i=3 is the start of the for loop, if you change that to 4 
or 5, you are set. However, no navigation  should ever be based on 
javascript, think accessibility.




More information about the thelist mailing list