Calc.asp
Page source
calculation example -- response
The sum is: 246
Script listing
calculation example -- response
<%
dim nbrIn1 'first input number from the form
dim nbrIn2 'second input number from the form
dim intSum 'the sum, which is returned
nbrIn1 = request.form ("txtN1")
nbrIn2 = request.form ("txtN2")
intSum = int(nbrIn1) + int(nbrIn2)
response.write ("The sum is: " & intSum)
%>
Explanation
The script creates three variables, two for the values the user entered (nbrIn1 and nbrIn2) into the form and the third for their sum (intSum). The form method of the request object returns the values the user entered.
After calculating the sum of the inputs, the script writes them to the output page using the write method of the response object.