<script>
function sum(obj) {
var oColl = obj.form.elements;
var total = 0;
for (var i=0; i < oColl.length; i++) {
if (oColl[i].name.substr(0,4)=="item" && oColl[i].checked)
total += parseInt(oColl[i].price);
}
obj.form.total.value = total;
}
</script>
<form>
<input type=checkbox name=item1 price=100 onClick="sum(this)">100원짜리<br>
<input type=checkbox name=item2 price=120 onClick="sum(this)">120원짜리<br>
<input type=checkbox name=item3 price=150 onClick="sum(this)">150원짜리<br>
<input type=text name=total value=0 readonly>
</form>
영삼넷
Categories
Recent Posts
Recent Comments
Statistics
- Total Visitors:
- 356178
- Today:
- 684227
- Yesterday:
- 9753381
IT강국 김영삼 블로그에 오신걸 진심으로 환영합니다.
©2002 영삼넷 // openkr
©2002 영삼넷 // openkr