Looping current div contents - Javascript
Posted: Fri Dec 07, 2007 7:09 pm
Hey Guys,
I have an upload script where the client should beable to specify how many files he has to upload, then javascript will multiply the existing 1 file upload which is already there.
I've got this so far, but its not working, is there a way to actually put the contents into a variable, because I believe innerHTML doesn't do this
filestobeuploaded is the div, which i need to multiply all content/html inside it. all form element names are already arrays, so element naming wont be an issue.
I have an upload script where the client should beable to specify how many files he has to upload, then javascript will multiply the existing 1 file upload which is already there.
I've got this so far, but its not working, is there a way to actually put the contents into a variable, because I believe innerHTML doesn't do this
filestobeuploaded is the div, which i need to multiply all content/html inside it. all form element names are already arrays, so element naming wont be an issue.
Code: Select all
function doMassMultiply(){
var addcount = document.getElementById('addcount');
var dafiles = document.getElementById('filestobeuploaded');
var dahtml = document.getElementById('filestobeuploaded').innerHTML;
for (i=1;i<=addcount;i++){
dafiles.write(dahtml);
}
}