Previous Chapter's Examples-|-Next Example-|-Return to Chapter Listing

Example 5.1:
Adding


Click this button to see the value in the nSum variable, the result of adding the values in two variables:


This is the script we used. First we placed this in the HEAD: <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- var nSum = 0 var nCost = 57 nSum = 25 + nCost + 33 //--> </SCRIPT> Then we created this button: <form> <input type="button" name="VariableButton" value="The result of the calculation" onclick="alert(nSum)"> </form>
Previous Chapter's Examples-|-Next Example-|-Return to Chapter Listing