diedVIPs

html knowhow

Konverter Temperatur









Konverter Temperatur
So sieht´s aus

°F
°R
°C
°C
K
     

Quellcode
<html>
<head>

<style type="text/css">
@media all and (max-width: 576px) {
.calc2 input[type=text], .calc2 input[type=number] { width:100%; padding:5px; }
.calc2 tr td:nth-child(2) { width:160px; width:calc(100% - 130px); }
.calc2 tr td:nth-child(3) { width: 30px; } }
</style>
</head>

<body >
<form name="calcform" autocomplete="off">
<table class="calc2">
<tr>
<td><label for="f">Fahrenheit:</label></td>
<td class="math"><input type="text" id="f" name="f" min="-459.67" tabindex="1"></td>
<td class="mathsymbol">&deg;F</td>
<td><input onclick="ConvertFahrenheit()" type="button" value="Convert" class="btn" tabindex="2"></td>
</tr>
<tr>
<td><label for="r">Rankine:</label></td>
<td class="math"><input type="number" id="r" name="r" min="0" tabindex="3"></td>
<td class="mathsymbol">&deg;R</td>
<td><input onclick="ConvertRankine()" type="button" value="Convert" class="btn" tabindex="4"></td>
</tr>
<tr>
<td><label for="cel">Celsius:</label></td>
<td class="math"><input type="text" id="cel" name="cel" min="-273.15" tabindex="5" autofocus></td>
<td class="mathsymbol">&deg;C</td>
<td><input onclick="ConvertCelsius()" type="button" value="Convert" class="btn" tabindex="6"></td>
</tr>
<tr>
<td><label for="cen">Centigrade:</label></td>
<td class="math"><input type="text" id="cen" name="cen" min="-273" tabindex="7"></td>
<td class="mathsymbol">&deg;C</td>
<td><input onclick="ConvertCentigrade()" type="button" value="Convert" class="btn" tabindex="8"></td>
</tr>
<tr>
<td><label for="k">Kelvin:</label></td>
<td class="math"><input type="number" id="k" name="k" min="0" tabindex="9"></td>
<td class="mathsymbol">K</td>
<td><input onclick="ConvertKelvin()" type="button" value="Convert" class="btn" tabindex="10"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="reset" value="Reset" class="btn" onclick="creset()"></td>
</tr>
</table>
</form></center>
<script src="https://www.rapidtables.com/convert/convert.js"></script>
<script>
function creset()
{ document.calcform.f.style.backgroundColor = "white";
document.calcform.r.style.backgroundColor = "white";
document.calcform.cel.style.backgroundColor = "white";
document.calcform.cen.style.backgroundColor = "white";
document.calcform.k.style.backgroundColor = "white"; }
function ConvertFahrenheit()
{ t = document.calcform.f.value;
if( t=='' ) return;
t = parseFloat(t);
if( t<-459.67 ) {
document.calcform.f.style.backgroundColor = "#ffdddd";
return; }
creset();
document.calcform.f.value = roundnum(t, 4);
document.calcform.r.value = roundnum((t+459.67), 4);
document.calcform.cel.value = roundnum((t-32)*5/9, 4);
document.calcform.cen.value = roundnum((t-32)*5/9, 4);
document.calcform.k.value = roundnum((t+459.67)*5/9, 4); }
function ConvertRankine()
{ t = document.calcform.r.value;
if( t=='' ) return;
t = parseFloat(t);
if( t<0 ) {
document.calcform.r.style.backgroundColor = "#ffdddd";
return; }
creset();
document.calcform.f.value = roundnum((t-459.67), 4);
document.calcform.r.value = roundnum(t, 4);
document.calcform.cel.value = roundnum((t-491.67)*5/9, 4);
document.calcform.cen.value = roundnum((t-491.67)*5/9, 4);
document.calcform.k.value = roundnum((t*5/9), 4); }
function ConvertCelsius()
{ t = document.calcform.cel.value;
if( t=='' ) return;
t = parseFloat(t);
if( t<-273.15 ) {
document.calcform.cel.style.backgroundColor = "#ffdddd";
return; }
creset();
document.calcform.f.value = roundnum((t*9/5+32), 4);
document.calcform.r.value = roundnum((t+273.15)*9/5, 4);
document.calcform.cel.value = roundnum(t, 4);
document.calcform.cen.value = roundnum(t, 4);
document.calcform.k.value = roundnum((t+273.15), 4); }
function ConvertCentigrade()
{ t = document.calcform.cen.value;
if( t=='' ) return;
t = parseFloat(t);
if( t<-273.15 ) {
document.calcform.cen.style.backgroundColor = "#ffdddd";
return; }
creset();
document.calcform.f.value = roundnum((t*9/5+32), 4);
document.calcform.r.value = roundnum((t+273.15)*9/5, 4);
document.calcform.cel.value = roundnum(t, 4);
document.calcform.cen.value = roundnum(t, 4);
document.calcform.k.value = roundnum((t+273.15), 4); }
function ConvertKelvin()
{ t = document.calcform.k.value;
if( t=='' ) return;
t = parseFloat(t);
if( t<0 ) {
document.calcform.k.style.backgroundColor = "#ffdddd";
return; }
creset();
document.calcform.f.value = roundnum((t*9/5-459.67), 4);
document.calcform.r.value = roundnum((t*9/5), 4);
document.calcform.cel.value = roundnum((t-273.15), 4);
document.calcform.cen.value = roundnum((t-273.15), 4);
document.calcform.k.value = roundnum(t, 4); }
</script>
</body>

</html>








Kontakt    Datenschutz   Impressum