2019-01-29 09:49:14 +00:00
|
|
|
<!DOCTYPE html><html><head>
|
|
|
|
<title>Calculator</title><meta charset="utf-8">
|
|
|
|
<script type="text/javascript">
|
|
|
|
function cube() {
|
2019-01-31 10:38:19 +00:00
|
|
|
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);
|
2019-01-29 09:49:14 +00:00
|
|
|
}
|
2019-01-31 10:39:14 +00:00
|
|
|
function inverse() {
|
|
|
|
var num = document.getElementById("n1");
|
|
|
|
num.value = Math.pow(num.value, -1);
|
|
|
|
}
|
2019-01-29 09:50:08 +00:00
|
|
|
function fourth() {
|
|
|
|
var num = document.getElementById("n1");
|
|
|
|
num.value = Math.pow(num.value, 4);
|
|
|
|
}
|
2019-01-29 09:49:14 +00:00
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Calculadora de Fernando Sánchez</h1>
|
|
|
|
Number:
|
|
|
|
<input type="text" id="n1"><p>
|
|
|
|
<button onclick="cube()"> x^3 </button>
|
2019-01-31 10:38:19 +00:00
|
|
|
<button onclick="square()"> x^2 </button>
|
2019-01-31 10:39:14 +00:00
|
|
|
<button onclick="inverse()"> 1/x </button>
|
2019-01-29 09:50:08 +00:00
|
|
|
<button onclick="fourth()"> x^4 </button>
|
2019-01-29 09:49:14 +00:00
|
|
|
</body>
|
|
|
|
</html>
|