Hi..
This is my code..
Actually i want to add values in this table..
Values are being added but suppose i change a value in a text box that value is added to total..
i.e. if num1=100,num2=1 00,num3=100 then total comes 300..
Now if i change num2=200(suppos e),then total comes 500 instead of 400...
Can someone where the problem is??
Thanx..
This is my code..
Actually i want to add values in this table..
Values are being added but suppose i change a value in a text box that value is added to total..
i.e. if num1=100,num2=1 00,num3=100 then total comes 300..
Now if i change num2=200(suppos e),then total comes 500 instead of 400...
Can someone where the problem is??
Code:
<%@language="VBScript"%>
<% option explicit %>
<html>
<head>
<script type="text/Javascript">
function check1()
{
document.frm.total.value=document.frm.price1.value;
}
function check2()
{
document.frm.total.value=(document.frm.total.value*1)+(document.frm.price2.value*1);
}
function check3()
{
document.frm.total.value=(document.frm.total.value*1)+(document.frm.price3.value*1);
}
</script>
</head>
<body>
<form name=frm>
<table border=1>
<tr>
<td>NUMBER 1 </td>
<td><input type=text name=price1 onchange="check1()"></td>
</tr>
<tr>
<td>NUMBER 2 </td>
<td><input type=text name=price2 onchange="check2()"></td>
</tr>
<tr>
<td>NUMBER 3 </td>
<td><input type=text name=price3 onchange="check3()"></td>
</tr>
<tr>
<td>Total</td>
<td><input type=text name=total></td>
</tr>
</table>
</form>
</body>
</html>
Comment