Full version: jsB@nk » Form » Textarea » JavaScript Add More Unlimited Input Fields
URL: https://www.javascriptbank.com/javascript-add-more-unlimited-input-fields.html
The type of this JavaScript effect can be seen on many upload-allowance sites, such as Youtube, Flickr, ImageShack, Picasa, etc. That's your visitors can upload files through this JavaScript code, after a file is selected (from local computer), another input field is automatically added for uploading. This JavaScript code made with DOM skills - a simple JavaScript code example but it's very effective to save the space for your web page.
Full version: jsB@nk » Form » Textarea » JavaScript Add More Unlimited Input Fields
URL: https://www.javascriptbank.com/javascript-add-more-unlimited-input-fields.html
<style type="text/css">/* This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com*/#imageUpload input {display: block;}</style>
<script type="text/javascript">// Created by: Jeroen Haan | http://www.haan.net// This script downloaded from JavaScriptBank.comfunction fileFields() { var x = document.getElementById('imageUpload'); x.onclick = function() { var i = parseFloat(this.lastChild.id)+1; input = document.createElement("input"); input.setAttribute("type", "file"); input.setAttribute("name", 'imageName_' + i); input.setAttribute("id", i); this.appendChild(input); }}// Multiple onload function created by: Simon Willison// http://simonwillison.net/2004/May/26/addLoadEvent/function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } }}addLoadEvent(function() { fileFields();});</script>
<a href="#" id="imageUpload"><input type="file" name="imageName_1" id="1" /></a>