Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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?

irt.org | Knowledge Base | JavaScript | Link | Q1459 [ previous next ]

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?

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?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.