Benutzer-Werkzeuge

Webseiten-Werkzeuge


offen:eignungstest3aufgabe
name:index.html
<!DOCTYPE html>
<html lang="de">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Währungsrechner</title>
  <link rel="icon" type="image/png" href="./img/arrows.png">
  <link rel="manifest" href="manifest.json">
  <link rel="preconnect" href="https://fonts.googleapis.com" />
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&display=swap"/>
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@100..900&display=swap">
 
	<style>
 
	</style>
	<script>
 
	</script>
</head>
<body>
  <div class="kopf">
    <img src="img/menu.png" height="20" alt="" />
Währungsrechner
  </div>
  <div class="container">
    <img class="flags" src="img/eu.png" alt="" />
    <input type="text" id="txtvar1" value="100"  />
    <span class="currency"></span>
    <span class="currency2">EUR</span>
  </div>
  <div class="container">
    <img src="img/arrows.png" id="umrechnung" height="60" title="Euros in Doller" onclick="umrechnungDrehen()" />
  </div>
  <div class="container">
    <img class="flags" src="img/usa.png" alt="" />
    <input type="text" id="txtvar2" />
    <span class="currency">$</span>
    <span class="currency2">USD</span>
  </div>
 
  <div class="container">
    <button onclick="calcE()">Doller in Euros</button>
    <button onclick="calcD()">Euros in Doller</button>	
  </div>
</body>
</html>

name:style.css
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);
}


name:code.js
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);
}
/volume1/web/dokuwiki/data/pages/offen/eignungstest3aufgabe.txt · Zuletzt geändert: 2024/07/25 22:53 von itbs