How to line break between document.write entries?
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?
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.
var fso = new ActiveXObject("Scripting.FileSystemObject");
oFileColl = new Enumerator(bbb.files);
abc = new Array();
document.all['listing'].innerHTML = "";
for (; !oFileColl.atEnd(); oFileColl.moveNext())
tempp = new String(oFileColl.item());
name = new String(fso.GetFileName(tempp));
//Tempp = file location.
//document.all['listing'].innerHTML += (name.link(tempp)+"\n\n");
var container = document.getElementById('myList');
var new_element = document.createElement('li');
new_element.innerHTML = (name.link(tempp)+"\n");
Here is an example that should work, writes a bold font sentence to the browser and ends the sentence with a newline using HTML.
document.write("<b>This is a test sentence</b><BR>");
Michael G. Workman
Thanks for the quick reply Michael, I think I tried all of the difficult ways and didn't think that would work. (That did.)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)