Updated calculator
This commit is contained in:
parent
95e9a37898
commit
fe23e6319c
2 changed files with 60 additions and 12 deletions
16
calc.css
16
calc.css
|
|
@ -4,9 +4,9 @@
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
color:aliceblue;
|
color:aliceblue;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
font-family: 'Ubuntu', sans-serif;
|
font-family: sans-serif;
|
||||||
font-size: 35px;
|
font-size: 35px;
|
||||||
width: 400px;
|
width: 500px;
|
||||||
border-top: rgba(0, 0, 0, 0);
|
border-top: rgba(0, 0, 0, 0);
|
||||||
border-left: rgba(0, 0, 0, 0);
|
border-left: rgba(0, 0, 0, 0);
|
||||||
border-right: rgba(0, 0, 0, 0);
|
border-right: rgba(0, 0, 0, 0);
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
height: 100px;
|
height: 100px;
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
color:aliceblue;
|
color:aliceblue;
|
||||||
font-family: 'Ubuntu', sans-serif;
|
font-family: sans-serif;
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
border: rgba(0, 0, 0, 0);
|
border: rgba(0, 0, 0, 0);
|
||||||
margin-left: -2;
|
margin-left: -2;
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
height: 100px;
|
height: 100px;
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
color:aliceblue;
|
color:aliceblue;
|
||||||
font-family: 'Ubuntu', sans-serif;
|
font-family: sans-serif;
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
border: rgba(0, 0, 0, 0);
|
border: rgba(0, 0, 0, 0);
|
||||||
margin-left: -3;
|
margin-left: -3;
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
height: 100px;
|
height: 100px;
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
color:aliceblue;
|
color:aliceblue;
|
||||||
font-family: 'Ubuntu', sans-serif;
|
font-family: sans-serif;
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
border: rgba(0, 0, 0, 0);
|
border: rgba(0, 0, 0, 0);
|
||||||
margin-left: -4;
|
margin-left: -4;
|
||||||
|
|
@ -82,4 +82,10 @@
|
||||||
}
|
}
|
||||||
button {
|
button {
|
||||||
outline: none;
|
outline: none;
|
||||||
|
}
|
||||||
|
#zero {
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
#equals {
|
||||||
|
width: 200px;
|
||||||
}
|
}
|
||||||
|
|
@ -24,24 +24,32 @@
|
||||||
<div id="calc">
|
<div id="calc">
|
||||||
<form>
|
<form>
|
||||||
<textarea id="eingabe" readonly></textarea>
|
<textarea id="eingabe" readonly></textarea>
|
||||||
|
</br>
|
||||||
|
<button type="button" onclick="klammeraufb()" class="numberbutton" id="klammerauf">(</button>
|
||||||
|
<button type="button" onclick="klammerzub()" class="numberbutton" id="klammerzu">)</button>
|
||||||
|
<button type="button" onclick="pib()" class="numberbutton" id="pi">π</button>
|
||||||
|
<button type="button" onclick="CE()" class="numberbutton" id="ce">C</button>
|
||||||
|
<button type="button" onclick="back()" class="numberbutton" id="backspace">«</button>
|
||||||
</br>
|
</br>
|
||||||
<button type="button" onclick="seven()" class="numberbutton" id="7">7</button>
|
<button type="button" onclick="seven()" class="numberbutton" id="7">7</button>
|
||||||
<button type="button" onclick="eight()" class="numberbutton" id="8">8</button>
|
<button type="button" onclick="eight()" class="numberbutton" id="8">8</button>
|
||||||
<button type="button" onclick="nine()" class="numberbutton" id="9">9</button>
|
<button type="button" onclick="nine()" class="numberbutton" id="9">9</button>
|
||||||
<button type="button" onclick="back()" class="numberbutton" id="backspace">«</button>
|
<button type="button" onclick="geteiltb()" class="numberbutton" id="geteilt">/</button>
|
||||||
|
<button type="button" onclick="quadratbb()" class="numberbutton" id="quadratb">x²</button>
|
||||||
</br>
|
</br>
|
||||||
<button type="button" onclick="four()" class="numberbutton" id="4">4</button>
|
<button type="button" onclick="four()" class="numberbutton" id="4">4</button>
|
||||||
<button type="button" onclick="five()" class="numberbutton" id="5">5</button>
|
<button type="button" onclick="five()" class="numberbutton" id="5">5</button>
|
||||||
<button type="button" onclick="six()" class="numberbutton" id="6">6</button>
|
<button type="button" onclick="six()" class="numberbutton" id="6">6</button>
|
||||||
<button type="button" onclick="CE()" class="numberbutton" id="ce">CE</button>
|
<button type="button" onclick="malb()" class="numberbutton" id="mal">*</button>
|
||||||
|
<button type="button" onclick="wurzelbb()" class="numberbutton" id="wurzelb">√</button>
|
||||||
</br>
|
</br>
|
||||||
<button type="button" onclick="one()" class="numberbutton" id="1">1</button>
|
<button type="button" onclick="one()" class="numberbutton" id="1">1</button>
|
||||||
<button type="button" onclick="two()" class="numberbutton" id="2">2</button>
|
<button type="button" onclick="two()" class="numberbutton" id="2">2</button>
|
||||||
<button type="button" onclick="three()" class="numberbutton" id="3">3</button>
|
<button type="button" onclick="three()" class="numberbutton" id="3">3</button>
|
||||||
<button type="button" onclick="plusb()" class="numberbutton" id="plus">+</button>
|
<button type="button" onclick="plusb()" class="numberbutton" id="plus">+</button>
|
||||||
|
<button type="button" onclick="minusb()" class="numberbutton" id="minus">-</button>
|
||||||
</br>
|
</br>
|
||||||
<button type="button" onclick="zero()" class="numberbutton" id="0">0</button>
|
<button type="button" onclick="zerobb()" class="numberbutton" id="zero">0</button>
|
||||||
<button type="button" onclick="pib()" class="numberbutton" id="pi">Pi</button>
|
|
||||||
<button type="button" onclick="coma()" class="numberbutton" id="coma">,</button>
|
<button type="button" onclick="coma()" class="numberbutton" id="coma">,</button>
|
||||||
<button type="button" onclick="equalsb()" class="numberbutton" id="equals">=</button>
|
<button type="button" onclick="equalsb()" class="numberbutton" id="equals">=</button>
|
||||||
|
|
||||||
|
|
@ -86,7 +94,7 @@
|
||||||
var t1 = document.getElementById("eingabe").value
|
var t1 = document.getElementById("eingabe").value
|
||||||
document.getElementById("eingabe").value = t1 + "9";
|
document.getElementById("eingabe").value = t1 + "9";
|
||||||
}
|
}
|
||||||
function zero() {
|
function zerobb() {
|
||||||
var t1 = document.getElementById("eingabe").value
|
var t1 = document.getElementById("eingabe").value
|
||||||
document.getElementById("eingabe").value = t1 + "0";
|
document.getElementById("eingabe").value = t1 + "0";
|
||||||
}
|
}
|
||||||
|
|
@ -100,7 +108,13 @@
|
||||||
function equalsb() {
|
function equalsb() {
|
||||||
var t1 = document.getElementById("eingabe").value
|
var t1 = document.getElementById("eingabe").value
|
||||||
var t2 = t1.replace("𝜋", "Math.PI");
|
var t2 = t1.replace("𝜋", "Math.PI");
|
||||||
document.getElementById("eingabe").value = eval(t2);
|
var t3 = t2.replace("²", "^2");
|
||||||
|
if(t1 != "") {
|
||||||
|
document.getElementById("eingabe").value = eval(t3);
|
||||||
|
} else {
|
||||||
|
document.getElementById("eingabe").value = "";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
function plusb() {
|
function plusb() {
|
||||||
var t1 = document.getElementById("eingabe").value
|
var t1 = document.getElementById("eingabe").value
|
||||||
|
|
@ -110,6 +124,34 @@
|
||||||
var t1 = document.getElementById("eingabe").value
|
var t1 = document.getElementById("eingabe").value
|
||||||
document.getElementById("eingabe").value = t1 + "𝜋";
|
document.getElementById("eingabe").value = t1 + "𝜋";
|
||||||
}
|
}
|
||||||
|
function klammeraufb() {
|
||||||
|
var t1 = document.getElementById("eingabe").value
|
||||||
|
document.getElementById("eingabe").value = t1 + "(";
|
||||||
|
}
|
||||||
|
function klammerzub() {
|
||||||
|
var t1 = document.getElementById("eingabe").value
|
||||||
|
document.getElementById("eingabe").value = t1 + ")";
|
||||||
|
}
|
||||||
|
function malb() {
|
||||||
|
var t1 = document.getElementById("eingabe").value
|
||||||
|
document.getElementById("eingabe").value = t1 + "*";
|
||||||
|
}
|
||||||
|
function geteiltb() {
|
||||||
|
var t1 = document.getElementById("eingabe").value
|
||||||
|
document.getElementById("eingabe").value = t1 + "/";
|
||||||
|
}
|
||||||
|
function quadratbb() {
|
||||||
|
var t1 = document.getElementById("eingabe").value
|
||||||
|
document.getElementById("eingabe").value = t1 + "²";
|
||||||
|
}
|
||||||
|
function minusb() {
|
||||||
|
var t1 = document.getElementById("eingabe").value
|
||||||
|
document.getElementById("eingabe").value = t1 + "-";
|
||||||
|
}
|
||||||
|
function wurzelbb() {
|
||||||
|
var t1 = document.getElementById("eingabe").value
|
||||||
|
document.getElementById("eingabe").value = t1 + "√";
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- FOOTER ---------------------------------------->
|
<!-- FOOTER ---------------------------------------->
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue