Example 1a:
Adding


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


This is the script we used. First we placed after the : <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- a=parseFloat(window.prompt("Δώσε τον πρώτο αριθμό a","0")); b=parseFloat(window.prompt("Δώσε τον δεύτερο αριθμό b","0")); c=parseFloat(window.prompt("Δώσε τον τρίτο αριθμό c","0")); document.writeln("a="+a+"<br>"); document.writeln("b="+b+"<br>"); document.writeln("c="+c+"<br>"); var nSum=a+b+c; document.writeln("δώσατε για 1ο αριθμό, "+ a + "<br>"); document.write("δώσατε για 2ο αριθμό, "+ b + "<br>"); document.writeln("δώσατε για 3ο αριθμό, " + c + "<P>"); document.writeln("Το άθροισμα, είναι: " + nSum + "<P>"); //--> </SCRIPT> Then we created this button: <form> <input type="button" value="The result of the calculation a+b+c" onclick=alert(nSum)> </form>
ΕΠΙΣΤΡΟΦΗ Επιστροφή στην ύλη της α΄ γυμνασίου