I am using the following server side javascript to create a directory listing:
<SCRIPT>
function collectLinks () {
var links =
dirListing.document && dirListing.document.links ?
dirListing.document.links : new Array();
return links;
}
function writeLinks () {
var links = collectLinks();
var d = main.document;
d.open();
for (var l = 0; l < links.length; l++)
d.write('<A HREF="' + links[l].href + '">' +
(links[l].text ? links[l].text : links[l].href) +
'<\/A><BR>');
d.close();
}
var url = location.search ? location.search.substring
(1) : 'about:blank';
var html = '';
html +=
'<FRAMESET ONLOAD="writeLinks()" ROWS="100%, *" FRAMEBORDER="0">';
html +=
'<FRAME NAME="main" SRC="about:blank" SCROLLING="auto" NORESIZE>';
html +=
'<FRAME NAME="dirListing" SRC="' + url + '" NORESIZE SCROLLING="no">';
html += '<\/FRAMESET>';
</SCRIPT>
</HEAD>
<SCRIPT>
document.write(html);
</SCRIPT>
</HTML>
The HTML file is called list.htm and I list a directory using list.htm?directoryname.
This however returns a list of links that contain the full path eg. What I'd like to do is just display the filename only whilst the underlying link contains the full path so the file can be accessed.
If someone could help, I would be very grateful.
Regards, Gary Pooley.
<SCRIPT>
function collectLinks () {
var links =
dirListing.document && dirListing.document.links ?
dirListing.document.links : new Array();
return links;
}
function writeLinks () {
var links = collectLinks();
var d = main.document;
d.open();
for (var l = 0; l < links.length; l++)
d.write('<A HREF="' + links[l].href + '">' +
(links[l].text ? links[l].text : links[l].href) +
'<\/A><BR>');
d.close();
}
var url = location.search ? location.search.substring
(1) : 'about:blank';
var html = '';
html +=
'<FRAMESET ONLOAD="writeLinks()" ROWS="100%, *" FRAMEBORDER="0">';
html +=
'<FRAME NAME="main" SRC="about:blank" SCROLLING="auto" NORESIZE>';
html +=
'<FRAME NAME="dirListing" SRC="' + url + '" NORESIZE SCROLLING="no">';
html += '<\/FRAMESET>';
</SCRIPT>
</HEAD>
<SCRIPT>
document.write(html);
</SCRIPT>
</HTML>
The HTML file is called list.htm and I list a directory using list.htm?directoryname.
This however returns a list of links that contain the full path eg. What I'd like to do is just display the filename only whilst the underlying link contains the full path so the file can be accessed.
If someone could help, I would be very grateful.
Regards, Gary Pooley.