Simple with js:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Calculator</title>
<script type="text/javascript">
var value = 0;
function calc() {
value = 0;
var el=document.getElementById("contents"),
c=el.getElementsByTagName("input");
for (var i=0;i<c.length;i++) {
if (c[i].checked==true&&c[i].type=="checkbox")
value = Number(value)+Number(c[i].getAttribute("rel"));
}
var t=document.getElementById("total"),
el=document.createElement("span");
while (t.firstChild) t.removeChild(t.firstChild);
el.appendChild(document.createTextNode(value));
t.appendChild(el);
}
</script>
</head>
<body>
<div id="contents">
Hockey Card #1:
<br><input type="checkbox" rel="20.00"> $20.00
<br>Hockey Card #2:
<br><input type="checkbox" rel="14.25"> $14.25
<br>Hockey Card #3:
<br><input type="checkbox" rel="15.00"> $15.00
<br>Hockey Card #4:
<br><input type="checkbox" rel="10.05"> $10.05
<br><input type="button" value="Calculate" onclick="calc()">
<br><b>Total:</b>
<div id="total"></div>
</div>
</body>
</html>
Hopefully you understand how to add cards/values.
Code:
<input type="checkbox" rel="15.02">
Once that check box is checked, it will add $15.02 to your total. Simple.
Bookmarks