[HTML run]<form>
<input type = "text">
<span id = "NewFields"></span>
<br> <input name = "MyField" type = "button" value = "+" onclick = 'CreateFormElement()'>
<input name = "MyField" type = "button" value = "-" onclick = 'CreateFormElement(true)'>
</form>
<script>
function CreateFormElement(remove){
var MyForm = document.getElementById('NewFields');
var input = remove ? MyForm.querySelector(':nth-last-child(1)') : document.createElement('input');
var br = remove ? MyForm.querySelector(':nth-last-child(2)') : document.createElement('br');
var ap = remove ? "removeChild" : "appendChild"
if(br)MyForm[ap](br);
if (input){input.type = 'text';
input.name = 'MyField';MyForm[ap](input);
}
}
</script>[/HTML]
<form>
<input type = "text">
<span id = "NewFields"></span>
<br> <input name = "MyField" type = "button" value = "+" onclick = 'CreateFormElement()'>
<input name = "MyField" type = "button" value = "-" onclick = 'CreateFormElement(true)'>
</form>
<script>
function CreateFormElement(remove){
var MyForm = document.getElementById('NewFields');
var input = remove ? MyForm.querySelector(':nth-last-child(1)') : document.createElement('input');
var br = remove ? MyForm.querySelector(':nth-last-child(2)') : document.createElement('br');
var ap = remove ? "removeChild" : "appendChild"
if(br)MyForm[ap](br);
if (input){input.type = 'text';
input.name = 'MyField';MyForm[ap](input);
}
}
</script>