Hello,
I’m using the script below to list files stored locally on a webpage (I’m developing a small application that is to be loaded from a CD-ROM). It’s been done in HTML as per my company’s request.
Essentially, this script works and successfully populates a list of files stored in the folder given by its parameter. However, I wanted a line break between the entries (hence n) but it doesn’t seem to work. I have tried the <pre> tag before and after the div this is printed to, as well as around the script – but it doesn’t seem to have any effect. All I get is spaces.
Do you have any ideas?
Thanks ?
P.S. I had an idea for an alternate solution, if it is an option: perhaps a better way would be to use an unordered list and have a script that adds list items to it? I can’t seem to find this anywhere online either.
[FONT=”Courier New”]<SCRIPT>
function listFiles(thefolder)
{
var fso = new ActiveXObject(“Scripting.FileSystemObject”);
if(fso.folderExists(thefolder))
{
bbb=fso.GetFolder(thefolder)
aaa=””
oFileColl = new Enumerator(bbb.files);
abc = new Array();
i=0
document.all[‘listing’].innerHTML = “”;
for (; !oFileColl.atEnd(); oFileColl.moveNext())
{
tempp = new String(oFileColl.item());
name = new String(fso.GetFileName(tempp));
//Tempp = file location.
if((tempp.indexOf(“.pdf”)!=-1)||(tempp.indexOf(“.dwg”)!=-1))
{
//document.all[‘listing’].innerHTML += (name.link(tempp)+”nn”);
var container = document.getElementById(‘myList’);
var new_element = document.createElement(‘li’);
new_element.innerHTML = (name.link(tempp)+”n”);
container.insertAfter(new_element, container.firstChild);
abc[i]=tempp
i++
aaa+=tempp+”n”
}
}
}
}
</SCRIPT>[/FONT]