<script type="text/javascript"> //<![CDATA[ var total = (parseInt($('#<%= txtmaxmarks.ClientID %>').val()) + parseInt($('#<%= txtmarks.ClientID %>').val())) * parseInt($('#<%= txtper.ClientID %>').val()); ct100_BodyContent_txtTotalOrder.initialvalue = total; //]]> </script>
x = 5, y = 2, calculate z = x + y, and display z:
<html> <head> <title>Input tutorial</title> <script language="javascript"> function addNumbers() { var val1 = parseInt(document.getElementById("value1").value); var val2 = parseInt(document.getElementById("value2").value); var ansD = document.getElementById("answer"); ansD.value = val1 + val2; } </script> </head> <body> value1 = <input type="text" id="value1" name="value1" value="1"/> value2 = <input type="text" id="value2" name="value2" value="2"/> <input type="button" name="Sumbit" value="Click here" onclick="javascript:addNumbers()"/> Answer = <input type="text" id="answer" name="answer" value=""/> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)