Hello Mparris ,
Here i have done the addition of 3 TextBox value in JavaScript and i am showing the result in p tag i.e (<p></p>).
Html:
<form id="form1" runat="server">
<div>
Black:
<asp:TextBox ID="txtBlack" runat="server" /><br />
Green:
<asp:TextBox ID="txtGreen" runat="server" /><br />
Gold:
<asp:TextBox ID="txtGold" runat="server" /><br />
Total:
<p id="pSum">
</p>
<br />
<asp:Button ID="btnCountSum" OnClientClick="CountSum();return false;" Text="Click Me"
runat="server" />
</div>
<script type="text/javascript">
function CountSum() {
var black = document.getElementById("txtBlack").value;
if (black == "") {
black = "0";
}
var green = document.getElementById("txtGreen").value;
if (green == "") {
green = "0";
}
var gold = document.getElementById("txtGold").value;
if (gold == "") {
gold = "0";
}
var sum = parseInt(black) + parseInt(green) + parseInt(gold);
if (!isNaN(sum)) {
document.getElementById("pSum").innerHTML = sum;
}
}
</script>
</form>
And if you want to learn javascript this link will be good for you.
http://www.w3schools.com/js/default.asp
Thank You.