[Solved] operations with javascript in html document


You are getting NaN because of this:

var altezza = document.getElementById('altezza');
var base = document.getElementById('base');
(base*altezza/2)

getElementById() does exactly that – gets the element. You just need to get the value from the element e.g. var altezza = document.getElementById('altezza').value;

solved operations with javascript in html document