<head runat="server">
<title></title>
<script type="text/javascript" language="javascript">
function sum() {
var value1 = document.getElementById("txt1").value;
if (value1.length < 1) {
value1 = 0;
}
var value2 = document.getElementById("txt2").value;
if (value2.length < 1) {
value2 = 0;
}
var value3 = document.getElementById("txt3").value;
if (value3.length < 1) {
value3 = 0;
}
var total = (parseInt(value1) + parseInt( value2) +parseInt( value3));
document.getElementById("txt4").value = total;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txt1" onkeyup="sum();" runat="server"></asp:TextBox><br />
<asp:TextBox ID="txt2" onkeyup="sum();" runat="server"></asp:TextBox><br />
<asp:TextBox ID="txt3" onkeyup="sum();" runat="server"></asp:TextBox><br />
<asp:TextBox ID="txt4" runat="server"></asp:TextBox><br />
</div>
</form>
</body>
<title></title>
<script type="text/javascript" language="javascript">
function sum() {
var value1 = document.getElementById("txt1").value;
if (value1.length < 1) {
value1 = 0;
}
var value2 = document.getElementById("txt2").value;
if (value2.length < 1) {
value2 = 0;
}
var value3 = document.getElementById("txt3").value;
if (value3.length < 1) {
value3 = 0;
}
var total = (parseInt(value1) + parseInt( value2) +parseInt( value3));
document.getElementById("txt4").value = total;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txt1" onkeyup="sum();" runat="server"></asp:TextBox><br />
<asp:TextBox ID="txt2" onkeyup="sum();" runat="server"></asp:TextBox><br />
<asp:TextBox ID="txt3" onkeyup="sum();" runat="server"></asp:TextBox><br />
<asp:TextBox ID="txt4" runat="server"></asp:TextBox><br />
</div>
</form>
</body>
No comments:
Post a Comment