Below is some JScript that creates new form elements (Thanks for the tip, Feyd, this was the right way to do it in the end!). When I submit the page, the contents of the textfields will be used to construct buttons on a preview page. Eventually, the contents will end up in a database.
Code: Select all
function addT(){
var root = document.getElementById('container');
var j=root.getElementsByTagName('div').length+1;
var clone = root.getElementsByTagName('div')[0].cloneNode(true);
var txt=clone.getElementsByTagName('input');
txt[0].name='link'+j;txt[0].value='URL';
txt[1].name='label'+j;txt[1].value='label';
root.appendChild(clone)
}Any suggestions would be greatly appreciated!
Thanks in advance