admiral,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script>
window.addEventListener("DOMContentLoaded", function() {
var form = document.querySelector("#main"),
res = document.querySelector("#res"),
data = {
text1: 25,
text2: 50,
checkbox1: 10,
checkbox2: 10
};
function calc() {
res.innerHTML = Object.keys(data).reduce(function(sum, id) {
var elem = document.getElementById(id);
var key = elem.type == "text" ? elem.value.trim() : elem.checked;
return key ? sum + data[id] : sum
}, 0)
}
form.addEventListener("change", calc, false);
form.addEventListener("input", calc, false)
});
</script>
</head>
<body>
<form action="http://" id="main">
<input type="text" id="text1"/>
<input type="text" id="text2"/>
и пару чекбоксов
<input type="checkbox" id="checkbox1"/>
<input type="checkbox" id="checkbox2"/>
</form>
<div id="res"></div>
</body>
</html>