<!DOCTYPE html>
<form id="calculator">
<label><input type="radio" name="type" value="R1" /> R1</label>
<label><input type="radio" name="type" value="R2" /> R2</label>
<button type="submit">Заслать</button>
<script>
(function(){
function getCheckedRadio(radios) {
for (var i = 0; i < radios.length; i++) {
if (radios[i].checked) {
return radios[i];
}
}
return null;
}
var form = document.forms.calculator;
form.onsubmit = function(){
var type = getCheckedRadio(form.type);
if (type) {
alert('Вы выбрали тип: ' + type.value);
}
return false;
}
})();
</script>
</form>