0

hello ,


i have products i create db
id,productname,price
------
1,cars,2000
2,renttv,20
3,blah,blah...


now i want make a checkbox for all this db

when you select the check box down give you total price

like if you select cars!

TOTAL PRICE: $2000

if you select 2 product like cars and renttv is come like this

TOTAL PRICE: $2020


all this in same page dont need to reload page


thank you

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by urtrivedi
0
<html>
<script lang='javascript'>
var total=0;
function findtotal(flag,value1)
{
	if (flag)
	   total=total+parseInt(value1, 10);
	else
	   total=total-parseInt(value1, 10);
	document.frm.total.value=total;
}
</script>
<body>
<form name=frm>
Cars <input type=checkbox value=2000 onclick="javascript:findtotal(this.checked,this.value)"><br>
Rendtv <input type=checkbox value=20 onclick="javascript:findtotal(this.checked,this.value)"><br>
Blah<input type=checkbox value=2590 onclick="javascript:findtotal(this.checked,this.value)"><br>
<input type=text readonly name=total id=total >
</form>
</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.