Ya lo conseguí,
Solo me gustaría saber si esta esta correcta la sintaxis y si hay declaraciones no indispensables que puedan resumir el codigo.
Este es el codigo:
Código:
<html>
<head>
<title>Problema</title>
</head>
<body>
<form name="myform" action=#>
<input type=text
name="gasto"
value="">
<input type=text
name="factura"
value="">
</form>
<button onclick="doIt()">do it</button>
<script>
function doIt()
{
var doc = document;
var f = doc.getElementById('myForm');
// show hidden
var el = f.elements.gasto;
el.style.display = "";
var es = f.elements.factura;
es.style.display = "";
// create/insert new
el = doc.createElement("input");
el = f.appendChild(el);
el.name = "newinput";
el.type = "text";
el.value = "";
es = doc.createElement("input");
es = f.appendChild(es);
es.name = "newinput";
es.type = "text";
es.value = "";
}
</script>
</body>
</html>