Google sites will filter out activities that it considers unsafe. Some details are here , but could not find official documentation with a quick search.
As another answer is mentioned, your variables require var declarations. This is necessary because without this, the variables will become global for the window and could potentially be used to exit any Google sandbox that hosts javascript support on sites, which can cause security problems.
So, to fix:
var x = parseFloat(document.getElementById("value1").value); var y = parseFloat(document.getElementById("value2").value);
source share