salu 2
ah yo tbm tenia es problema pero el mio era con un texbox y un radio button bueno espero q te sirva ya esta funcionando
Código PHP:
<html>
<head>
<title>Crear input file</title>
<script type="text/javascript">
num=0;
function crear(obj) {
num++;
fi = document.getElementById('fiel'); // ponemos en el field
contenedor = document.createElement('div');
contenedor.id = 'div'+num;
fi.appendChild(contenedor);
ele=document.createElement('input');
ele.type='text';
ele.name='text-'+num;
contenedor.appendChild(ele);
ele = document.createElement('input');
ele.type = 'radio';
ele.name='a';
ele.value='id-'+num;
contenedor.appendChild(ele); //el appendchild parece q no funciona (innerhtml)
ele = document.createElement('input');
ele.type = 'button';
ele.value = 'Borrar';
ele.name = 'div'+num;
ele.onclick = function () {borrar(this.name)}
contenedor.appendChild(ele);
}
function borrar(obj) {
fi = document.getElementById('fiel');
fi.removeChild(document.getElementById(obj));
}
</script>
</head>
<body>
<form >
<fieldset id="fiel">
<input type="button" value="Crear" onclick="crear(this)" />
</fieldset>
</form>
</body>
</html>
salu2