First, I used this script: http://www.javascriptkit.com/script/script2/breadcrumb.shtml The script works fine but all of my pages are showing up in just one "directory" (Home.) For instance, Home > How to Order, Home > Custom Drapes, etc... The script supposedly shows the links based on the "Directory Tree" but I'm not sure how to edit my web pages in the Directory Tree. I tried just creating the navigation by dragging & dropping the pages into the navigation tree but that didn't work. Does anyone know how to create the directories or make certain pages "under" other pages? Thanks! Beverly
It appears you create your structure by placing your pages within folders. The script uses those folder names to populate your breadcrumbs. So, "Home > How to Order" would be achieved by having a How To Order page in your root web directory. If you wanted "Home > How to Order > Order By Credit Card" you would need to have Order By Credit Card inside a How To Order folder.
Need further help, please... When I create a folder (ie "Sample Folder"), when it shows up in my browser, it shows as "Sample%20Folder" - How do I get rid of the "%20" that shows up where I have a space in the folder name? Thanks!!
Try adding: url = url.replace(/%20/g,' '); Code (markup): right before the writeln statement. That should replace all instances of %20 with a space.
Can you confirm where "right before the writeln statement" is? Do you mean before this line? document.write(output + document.title); Thanks!
Umm, I'm not seeing the line of code you referenced. Here - I pulled the script off the link you provided in your first post, and I inserted a little comment to tell you where to put that one line of code I wrote: <SCRIPT LANGUAGE="JavaScript"> <!-- //Bread crumb script - Kevin Lynn Brown //Duplicate directory names bug fix by JavaScriptKit.com //Visit JavaScript Kit (http://javascriptkit.com) for script var path = ""; var href = document.location.href; var s = href.split("/"); for (var i=2;i<(s.length-1);i++) { path+="<A HREF=\""+href.substring(0,href.indexOf("/"+s[i])+s[i].length+1)+"/\">"+s[i]+"</A> / "; } i=s.length-1; path+="<A HREF=\""+href.substring(0,href.indexOf(s[i])+s[i].length)+"\">"+s[i]+"</A>"; var url = window.location.protocol + "//" + path; // \/ \/ \/ \/ \/ PUT YOUR CODE IN HERE \/ \/ \/ \/ \/ // /\ /\ /\ /\ /\ PUT YOUR CODE IN HERE /\ /\ /\ /\ /\ document.writeln(url); //--> </script> <p align="left"><font face="arial" size="-2">This free script provided by <a target=_top href="http://javascriptkit.com">JavaScript Kit</a></font></p> Code (markup): Can't miss it If this isn't the script you're using, post the actual script, and I'll edit that one for you.
Thanks so much for your help... It is a different script (sorry) but I think I must have put it in the wrong spot b/c nothing changed.... http://www.andrewcalzada.com/Custom Silk Drapes/test.htm Please advise. Thanks again!
Script looks like this: function breadcrumbs(){ sURL = new String; bits = new Object; var x = 0; var stop = 0; var output = "<a href=\"/\">Home</a> » "; sURL = location.href; sURL = sURL.slice(8,sURL.length); chunkStart = sURL.indexOf("/"); sURL = sURL.slice(chunkStart+1,sURL.length) while(!stop){ chunkStart = sURL.indexOf("/"); if (chunkStart != -1){ bits[x] = sURL.slice(0,chunkStart) sURL = sURL.slice(chunkStart+1,sURL.length); }else{ stop = 1; } x++; } for(var i in bits){ output += "<a href=\""; for(y=1;y<x-i;y++){ output += "../"; } output += bits + "/\">" + bits + " » "; } document.write(output + document.title); url = url.replace(/%20/g,' ');} // --> </script>
Well yes, it won't work because the script variable is different here than in the first script you linked Try this: Function breadcrumbs(){ sURL = new String; bits = new Object; var x = 0; var stop = 0; var output = "<a href=\"/\">Home</a> » "; sURL = location.href; sURL = sURL.slice(8,sURL.length); chunkStart = sURL.indexOf("/"); sURL = sURL.slice(chunkStart+1,sURL.length) while(!stop){ chunkStart = sURL.indexOf("/"); if (chunkStart != -1){ bits[x] = sURL.slice(0,chunkStart) sURL = sURL.slice(chunkStart+1,sURL.length); }else{ stop = 1; } x++; } for(var i in bits){ output += "<a href=\""; for(y=1;y<x-i;y++){ output += "../"; } output += bits + "/\">" + bits + " » "; ourput = output.replace(/%20/g,' '); } document.write(output + document.title); }
is that 4th line from the bottom supposed to be "output"? I assumed it was and inserted it. Now, the page has an error and won't load that breadcrumb. http://www.andrewcalzada.com/Custom Silk Drapes/test.htm Did I insert it correctly? Any other ideas? Thanks!
Try reverting it back to the original. I'm using the markup you provided above to test this, and it's not working. If I can pull the working markup out of your site, I'll be able to modify it properly. Thanks!
Ok, I reverted back to the original script. Here's the test link: http://www.andrewcalzada.com/Custom Silk Drapes/test.htm Thanks!!