Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server side directory list generation question

Status
Not open for further replies.

washoc

Technical User
Oct 24, 2001
10
0
0
GB
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=&quot;' + links[l].href + '&quot;>' +
(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=&quot;writeLinks()&quot; ROWS=&quot;100%, *&quot; FRAMEBORDER=&quot;0&quot;>';
html +=
'<FRAME NAME=&quot;main&quot; SRC=&quot;about:blank&quot; SCROLLING=&quot;auto&quot; NORESIZE>';
html +=
'<FRAME NAME=&quot;dirListing&quot; SRC=&quot;' + url + '&quot; NORESIZE SCROLLING=&quot;no&quot;>';
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top