[Javascript] Adding more HTML to DIV with form

Peter Lauri lists at dwsasia.com
Tue Jun 13 05:38:27 CDT 2006


Hi,

I have a script that adds HTML to a specific DIV with a specific ID:

function add_morefile() {
    var x = document.getElementById('attach_file');
    x.innerHTML += '<table><div class="doc_attach"><tr><td><label
for="author">Attachment file: </label></td><td><input class="big"
name="doc_attach[]" id="doc_attach"  type="file" class="typefile"
/></td></tr><tr><td><label for="File Name">File Name:
</label></td><td><input class="big" name="doc_filename[]" id="doc_filename"
type="text" /></td></tr><tr><td><label for="File Name Author">File created
by: </label></td><td><input class="big" name="doc_filename_author[]"
id="doc_filename_author" type="text" /></td></tr></table>';
}

If the user has filled in information in the form already, all information
is still there except in the <input type="file"...> object. Why is that?

If I want to add more form fields, should I use an other function to keep
the <input type="file"...> value?

Best regards,
Peter Lauri




More information about the Javascript mailing list