1
0
mirror of https://github.com/balkian/my_calculator_2.git synced 2024-11-22 07:22:29 +00:00

1/x button

This commit is contained in:
J. Fernando Sánchez 2019-01-31 11:39:14 +01:00
parent b95b431fc2
commit 5af6569228

View File

@ -9,6 +9,10 @@ function square() {
var num = document.getElementById("n1");
num.value = Math.pow(num.value, 2);
}
function inverse() {
var num = document.getElementById("n1");
num.value = Math.pow(num.value, -1);
}
</script>
</head>
<body>
@ -17,5 +21,6 @@ Number:
<input type="text" id="n1"><p>
<button onclick="cube()"> x^3 </button>
<button onclick="square()"> x^2 </button>
<button onclick="inverse()"> 1/x </button>
</body>
</html>