I have this code of a breadcrumb that I found, but it shows the whole link. How can I make a similar simple breadcrumb that shows only the name of the page based on the path? (only in JavaScript) (it would be good to change the background color too)
<SCRIPT LANGUAGE="JavaScript">
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;
document.writeln(url);
</script>