Full version: jsB@nk » Form » Textarea » Adding HTML Controls
URL: https://www.javascriptbank.com/adding-html-controls.html
Use this JavaScript to add HTML controls to your forms. This example uses the <input> tag.
Full version: jsB@nk » Form » Textarea » Adding HTML Controls
URL: https://www.javascriptbank.com/adding-html-controls.html
<script type="text/javascript"><!-- Begin/*Created by: Husay :: http://www.communitxt.net */var arrInput = new Array(0); var arrInputValue = new Array(0);function addInput() { //arrInput.push(createInput(arrInput.length)); arrInput.push(arrInput.length); //arrInputValue.push(arrInputValue.length); arrInputValue.push(""); display();}function display() { document.getElementById('parah').innerHTML=""; for (intI=0;intI<arrInput.length;intI++) { document.getElementById('parah').innerHTML+=createInput(arrInput[intI], arrInputValue[intI]); }}function saveValue(intId,strValue) { arrInputValue[intId]=strValue;} function createInput(id,value) { return "<input type='text' id='test "+ id +"' onChange='javascript:saveValue("+ id +",this.value)' value='"+ value +"'><br>";}function deleteInput() { if (arrInput.length > 0) { arrInput.pop(); arrInputValue.pop(); } display(); }// End --></script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<p id="parah">Dynamic creation of input boxes</p><a href="javascript:addInput()">Add more input field(s)</a><br><a href="javascript:deleteInput()">Remove field(s)</a><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->