Hy,
Try test and use this example.
The user can add text-fields, but you can replace it with type="file"
Code:<script type="text/javascript"> <!-- // - www.coursesweb.net/javascript/ // creates an input element and adds it before the Submit button function add_input() { var new_input = document.createElement("input"); new_input.setAttribute("type", "text"); new_input.setAttribute("name", "nume[]"); new_input.style.display = 'block'; // Seteaza display:block; pt. a afisa casutele unele sub altele // sets the objects for reference (reper) and parent var reper = document.getElementById('submit'); var parinte = reper.parentNode; // Adds the new element parinte.insertBefore(new_input, reper); } //--> </script> <form action=""> <input type="text" name="nume[]" /> <input type="submit" value="Submit" id="submit" /><br /><br /> <input type="button" value="Add field" onclick="add_input()" /> </form>





Reply With Quote