rockstardub
Programmer
Code:
<html>
<head>
<script language="JavaScript">
// by Kirk Strobeck | kirkstrobeck.com | kirk@strobeck.com //
function initialize() {
Total = 0;
totalprice.innerText = Total;
}
function checkoption(checkbox) {
checknum = parseInt(checkbox.value); //Turn the value into a number
if (checkbox.checked == true) {
Total += checknum;
} else {
Total -= checknum;
}
totalprice.innerText = Total;
}
</script>
</head>
<body onload="initialize();">
<form name="main">
<input type="checkbox" name="feature1" value="100" onclick="checkoption(this);"> Item Cost: $100<br>
<input type="checkbox" name="feature2" value="300" onclick="checkoption(this);"> Item Cost: $300<br>
<input type="checkbox" name="feature3" value="700" onclick="checkoption(this);"> Item Cost: $700<br>
</form>
Your total is: <b>$<span id="totalprice"></span>.00</b>
</body>
</html>
Enjoy!