var a = document.getElementById("metr"), b = document.getElementsByName("radio-531"), c = document.getElementById("summ"); b[0].onchange = b[1].onchange = a.onkeyup = function () { c.value = a.value * (b[0].checked ? 90 : 40); };