1
0
mirror of https://github.com/balkian/my_calculator_2.git synced 2024-10-31 22:11:42 +00:00
my_calculator_2/calculator.html
J. Fernando Sánchez 5af6569228 1/x button
2019-01-31 11:41:30 +01:00

27 lines
658 B
HTML

<!DOCTYPE html><html><head>
<title>Calculator</title><meta charset="utf-8">
<script type="text/javascript">
function cube() {
var num = document.getElementById("n1");
num.value = Math.pow(num.value, 3);
}
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>
<h1>Calculadora de Fernando Sánchez</h1>
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>