wjordaan
09-10-2002, 04:06 PM
Hi All.
I started using this code to display dynamic text links displaying the visitor's current location as text links (thanx to Kevin Lynn Brown).
The idea is that the user can jump back to any of the locations higher up the path.
This is the code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
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)+"/\">"+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);
// End -->
</script>
It would output something like:
http://tripletech006 > Projects > Barclays > Demo > Crestron > Laptop > index.htm
What I would like to achieve is to start displaying from 'Crestron and ignore everything else before that so, output should look like:
Crestron > Laptop > index.htm
The 'challange' is that the code will not always sit on the same machine, so we cannot just tell it to ignore a specific path.
Would it be a good idea to look for the first instance of a 'specified' word and then to use that as the start of the links to be displayed?
I have no idea where or how to do this, so any help would be appreciated.
Thanx.
Will.
I started using this code to display dynamic text links displaying the visitor's current location as text links (thanx to Kevin Lynn Brown).
The idea is that the user can jump back to any of the locations higher up the path.
This is the code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
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)+"/\">"+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);
// End -->
</script>
It would output something like:
http://tripletech006 > Projects > Barclays > Demo > Crestron > Laptop > index.htm
What I would like to achieve is to start displaying from 'Crestron and ignore everything else before that so, output should look like:
Crestron > Laptop > index.htm
The 'challange' is that the code will not always sit on the same machine, so we cannot just tell it to ignore a specific path.
Would it be a good idea to look for the first instance of a 'specified' word and then to use that as the start of the links to be displayed?
I have no idea where or how to do this, so any help would be appreciated.
Thanx.
Will.