Hello.
I am using a script that I received from someone after I posted a request at this site (thanks!), which finds a specific directory name and displays it on the webpage in a specified table. The script is working well, except for directories with two or more words. If the multiple word directory name is written with an _underscore_ in place of the blank space, then the underscore is displayed in the title. If the directory has a blank space, then the blank space is displayed as "%20" in the title.
For example:
1) A directory named "Blue_Bird" becomes a section title displayed as "Blue_Bird" ... but I would like the script to be told to substitutle a blank space for an underscore, so the title would read: "Blue Bird"
2) A directory named "Red Bird" becomes a section title displayed as "Red%20Bird" ... but I would like the script to be told to display a blank space for a blank space (or for a "%20", if it is picking this up from the code), so the title would read: "Red Bird"
Following is a copy of the existing script:
<script type="text/javascript">
function disp_current_directory(){
var ext='htm';
var dirs=window.location.href.split('/'),
cdir=dirs[dirs.length-2];
document.write('<a href="'+cdir.toLowerCase()+'.'+ext+'">'+cdir.toUpperCase()+'<\/a>');
}
disp_current_directory();
</script>
Thanks in advance for any help!
Larry



Reply With Quote


Bookmarks