-
JAVASCRIPT-NAVIGATION-LINKS.PHPScritto daNon Autenticatoil 2008-08-02 19:37:00.0 alle 2008-08-02 19:37:00.0
function Directories() { directory = document.location.pathname; directories = new Array(); do {//Creates an array with all the parent folders //of the file where this function is called. last_slash = directory.lastIndexOf('/'); if(last_slash != false) { directory = directory.substr(0, last_slash); directories[directories.length] = directory; } } while(last_slash != false); return(directories); } //Uses the Directories() function to create the links. function navigation_links() { directories = new Directories(); links = '<a href="/">Home</a> '; for(index = directories.length - 1; index >= 0; index--) { //Handling the display is a little harder than the links themselves. dir_name = directories[index]; dir_name = dir_name.substr(dir_name.lastIndexOf('/') + 1, dir_name.strlen); links += '<a href="' + directories[index] + '">' + dir_name + '</a> '; } document.write(links); }
695994