Währungsrechner

Währungsrechner
----
body {
background-color: #0d75eb;
margin: 0;
color: rgb(224, 255, 48);
font-size: 28px;
/* font-family: 'Open Sans', sans-serif; */
font-family: "Roboto Slab", serif;
font-optical-sizing: auto;
font-weight: 400;
font-style: normal;
}
div {
background-color: rgb(14, 167, 228);
min-height: 80px;
margin-bottom: 5px;
}
.kopf {
min-height: 30px;
padding: 16px;
display: flex;
align-items: center;
gap: 16px;
background-color: rgba(255,255,255,0.1);
/* background-color: blue; */
/* position: relative; */
}
.flags {
position: absolute;
left:45px;
width: 50px;
}
.currency {
position: absolute;
right: 80px;
font-weight: 800;
/* bottom: 20px; */
}
.currency2 {
position: absolute;
right: 30px;
font-weight: 400;
color: darkolivegreen;
font-size: medium;
bottom: 15px;
}
input {
height: 60px;
background-color: rgba(255,255,255,0.1);
border-radius: 25px;
flex: 1;
/* padding-left: 100px; */
text-align: right;
padding-right:2.8em;
color: rgb(70, 252, 161);
font-size: larger;
}
.container {
background-color: rgba(0, 255, 106,0.5);
display: flex;
justify-content: center;
align-items: center;
padding: 1px 15px;
/* gap:10px; */
position: relative;
}
button {
background-color: #e7eb08;
font-size: 14px;
color: #0d72f5;
font-weight: 600;
/* flex:1; */
width: 40%;
justify-content: space-between;
/* gap:10px; */
padding: 10px 42px;
margin: 0 10px;
height: 50px;
border: unset;
border-radius: 20px;
box-shadow: 2PX 2PX 2PX rgba(0,0,0,0.8);
cursor: pointer;
}
#umrechnung {
transform: rotate(180deg);
}
----
----
let rotated = true;
const EDKURS = 1.0848;// 25.07.2024 //0.981;
function calcD() {
let euro = txtvar1.value.replace(',','.');
let result = euro * EDKURS;
console.log(result);
try{
txtvar2.value = result.toFixed(2).replace('.',',');
}catch(e){
console.error(e);
txtvar2.value = result.toFixed(2);
}
let u = document.getElementById("umrechnung");
u.style.transform = 'rotate(180deg)';
rotated = true;
u.setAttribute("title","Euros in Doller");
}
function calcE() {
let doller = txtvar2.value.replace(',','.');
let result = doller / EDKURS;
try {
txtvar1.value = result.toFixed(2).replace('.',',');
}catch(e){
console.error(e);
txtvar1.value = result.toFixed(2);
}
let u = document.getElementById("umrechnung");
u.style.transform = 'rotate(0deg)';
rotated = false;
u.setAttribute("title","Doller in Euros");
}
function umrechnungDrehen() {
const compStyles = window.getComputedStyle(umrechnung);
let transform = compStyles.getPropertyValue('transform');
//alert(transform);
let u = document.getElementById("umrechnung");
if(rotated == true){
u.style.transform = 'rotate(0deg)';
u.setAttribute("title","Doller in Euros");
}else{
u.style.transform = 'rotate(180deg)';
u.setAttribute("title","Euros in Doller");
}
rotated = !rotated;
transform = compStyles.getPropertyValue('transform');
//alert(transform);
}