Question : How can I display text or a cost based off a selection of checkboxes that are checked?

I have three checkboxes and each checkbox has a cost associated to it when clicked. I would like to automate a text total cost value at the bottom of the page based off the check or uncheck selection of each checkbox. I need to keep the value of "1" for each checkbox.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>


<input name="checkbox1" type="checkbox" value="1" />
<input name="checkbox2" type="checkbox" value="1" />
<input name="checkbox3" type="checkbox" value="1" />

Value

</body>
</html>

Answer : How can I display text or a cost based off a selection of checkboxes that are checked?

check this :

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
	var value = 0;
	function addsub(w) {
		if(w.checked) value+=parseFloat(w.value); else value-=parseFloat(w.value);
		document.getElementById("value").innerHTML = "value = " + value;
	}
</script>
</head>
<body>
<input name="checkbox1" type="checkbox" value="1" onclick="addsub(this);" />
<input name="checkbox2" type="checkbox" value="1" onclick="addsub(this);" />
<input name="checkbox3" type="checkbox" value="1" onclick="addsub(this);" />
<div id="value">Value</div>
</body>
</html>
</body>
</html>
Random Solutions  
 
programming4us programming4us