Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1459 How would you put the directory structure of a page at the top of a page (eg You are here: domain.com > directory > sub-directory > page.html, but where each part is a link to the relevant directory/file?

You are here: irt.org | FAQ | JavaScript | Link | Q1459 [ previous next ]

Try:

<script language="JavaScript"><!--
thePath = '';
loc = '' +location.href;
paths = loc.substring(7).split('/');
file = loc.substring(0,6);
for (i=0, n=paths.length;i<n;i++) {
  file += "/" + paths[i];
  thePath += '> <a href="' + file + '">' + paths[i] + '<\/a> ';
}
document.write('You are here: ' + thePath.substring(1));
//--></script>

Feedback on 'Q1459 How would you put the directory structure of a page at the top of a page (eg You are here: domain.com > directory > sub-directory > page.html, but where each part is a link to the relevant directory/file?'

©2018 Martin Webb