<html>
<head>
<script>
var total=0;
function sumar(valor) {
total += valor;
document.formulario.total.value=total;
}
function restar(valor) {
total-=valor;
document.formulario.total.value=total;
}
</script>
</head>
<body>
<form name=formulario>
<input name="checkbox" type="checkbox" onClick="if (this.checked) sumar(1); else restar(1)" value="checkbox">$1<br>
<input name="checkbox" type="checkbox" onClick="if (this.checked) sumar(2); else restar(2)" value="checkbox">$2<br>
<input type="text" name="total" value="0">
</form>
</body>
</html>