var memoria = document.getElementById('pantalla').value;
var memoria2 = document.getElementById('pantalla').value;
//almaceno en variable el valor del campo id="pantalla", en esta caso es un input tipo text.
Now I have to create a function that:
-
Delete field
input
typetext
withid="pantalla"
, but keep the value of the variable memory. -
I must rewrite another value in the field
input
typetext
withid="pantalla"
and add it to the variable memory.
I have tried to do this but it does not work. Does anyone have any better idea of how I could do it?
function sumar(){
document.getElementById('pantalla').value = ""; //Esto borra el campo.
document.getElementById('pantalla').value = "memoria2";
var suma = (memoria + memoria2)
document.calcu.visor.value = suma;
}