diedVIPs

html knowhow

Konverter für Gewichte









Konverter für Gewichte
So sieht´s aus

Quellcode
<html>
<head>
<script async src='https://www.rapidtables.com/cdn-cgi/challenge-platform/h/g/scripts/invisible.js?ts=1655640000'></script>

<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: 240px; width: calc(100% - 130px); }
.calc2 tr td:nth-child(3) { width: 30px; } }
</style>
</head>

<body >
<form name="calcform" autocomplete="off">
<table class="auto-style30" style="width: 500px">
<tr>
<td><label for="ton">Tonnen:</label></td>
<td class="math"><input type="number" min="0" step="any" id="ton" name="ton" autofocus></td>
<td class="mathsymbol">t</td>
<td><input onclick="ConvertTon()" type="button" value="Convert" class="btn"></td>
</tr>
<tr>
<td><label for="kg">Kilogramm:</label></td>
<td class="math"><input type="number" min="0" step="any" id="kg" name="kg"></td>
<td class="mathsymbol">kg</td>
<td><input onclick="ConvertKg()" type="button" value="Convert" class="btn"></td>
</tr>
<tr>
<td><label for="gr">Gramm:</label></td>
<td class="math"><input type="number" min="0" step="any" id="gr" name="gr"></td>
<td class="mathsymbol">g</td>
<td><input onclick="ConvertGr()" type="button" value="Convert" class="btn"></td>
</tr>
<tr>
<td><label for="mg">Milligramm:</label></td>
<td class="math"><input type="number" min="0" step="any" id="mg" name="mg"></td>
<td class="mathsymbol">mg</td>
<td><input onclick="ConvertMg()" type="button" value="Convert" class="btn"></td>
</tr>
<tr>
<td><label for="mcg">Microgramm:</label></td>
<td class="math"><input type="number" min="0" step="any" id="mcg" name="mcg"></td>
<td class="mathsymbol">mcg</td>
<td><input onclick="ConvertMcg()" type="button" value="Convert" class="btn"></td>
</tr>
<tr>
<td><label for="st">Stones:</label></td>
<td class="math"><input type="number" min="0" step="any" id="st" name="st"></td>
<td class="mathsymbol">st</td>
<td><input onclick="ConvertSt()" type="button" value="Convert" class="btn"></td>
</tr>
<tr>
<td><label for="lb">Pounds:</label></td>
<td class="math"><input type="number" min="0" step="any" id="lb" name="lb"></td>
<td class="mathsymbol">lb</td>
<td><input onclick="ConvertLb()" type="button" value="Convert" class="btn"></td>
</tr>
<tr>
<td><label for="oz">Unzen:</label></td>
<td class="math"><input type="number" min="0" step="any" id="oz" name="oz"></td>
<td class="mathsymbol">oz</td>
<td><input onclick="ConvertOz()" type="button" value="Convert" class="btn"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="reset" value="Reset" class="btn"></td>
</tr>
</table>
</form>

<script src="https://www.rapidtables.com/convert/convert.js"></script>
<script>
function ConvertTon()
{ d = document.calcform.ton.value;
if( d=='' ) return;
d = parseFloat(d);
document.calcform.ton.value = roundnum(d, 6);
document.calcform.kg.value = roundnum(d*1e3, 6);
document.calcform.gr.value = roundnum(d*1e6, 6);
document.calcform.mg.value = roundnum(d*1e9, 6);
document.calcform.mcg.value = roundnum(d*1e12, 6);
document.calcform.st.value = roundnum(d*1e3/0.45359237/14, 6);
document.calcform.lb.value = roundnum(d*1e3/0.45359237, 6);
document.calcform.oz.value = roundnum(d*1e3/0.45359237*16, 6); }
function ConvertKg()
{ d = document.calcform.kg.value;
if( d=='' ) return;
d = parseFloat(d);
document.calcform.ton.value = roundnum(d*1e-3, 6);
document.calcform.kg.value = roundnum(d, 6);
document.calcform.gr.value = roundnum(d*1e3, 6);
document.calcform.mg.value = roundnum(d*1e6, 6);
document.calcform.mcg.value = roundnum(d*1e9, 6);
document.calcform.st.value = roundnum(d/0.45359237/14, 6);
document.calcform.lb.value = roundnum(d/0.45359237, 6);
document.calcform.oz.value = roundnum(d/0.45359237*16, 6); }
function ConvertGr()
{ d = document.calcform.gr.value;
if( d=='' ) return;
d = parseFloat(d);
document.calcform.ton.value = roundnum(d*1e-6, 6);
document.calcform.kg.value = roundnum(d*1e-3, 6);
document.calcform.gr.value = roundnum(d, 6);
document.calcform.mg.value = roundnum(d*1e3, 6);
document.calcform.mcg.value = roundnum(d*1e6, 6);
document.calcform.st.value = roundnum(d*1e-3/0.45359237/14,6);
document.calcform.lb.value = roundnum(d*1e-3/0.45359237, 6);
document.calcform.oz.value = roundnum(d*1e-3/0.45359237*16,6); }
function ConvertMg()
{ d = document.calcform.mg.value;
if( d=='' ) return;
d = parseFloat(d);
document.calcform.ton.value = roundnum(d*1e-9, 6);
document.calcform.kg.value = roundnum(d*1e-6, 6);
document.calcform.gr.value = roundnum(d*1e-3, 6);
document.calcform.mg.value = roundnum(d, 6);
document.calcform.mcg.value = roundnum(d*1e3, 6);
document.calcform.st.value = roundnum(d*1e-6/0.45359237/14,6);
document.calcform.lb.value = roundnum(d*1e-6/0.45359237, 6);
document.calcform.oz.value = roundnum(d*1e-6/0.45359237*16,6); }
function ConvertMcg()
{ d = document.calcform.mcg.value;
if( d=='' ) return;
d = parseFloat(d);
document.calcform.ton.value = roundnum(d*1e-12, 6);
document.calcform.kg.value = roundnum(d*1e-9, 6);
document.calcform.gr.value = roundnum(d*1e-6, 6);
document.calcform.mg.value = roundnum(d*1e-3, 6);
document.calcform.mcg.value = roundnum(d, 6);
document.calcform.st.value = roundnum(d*1e-9/0.45359237/14,6);
document.calcform.lb.value = roundnum(d*1e-9/0.45359237, 6);
document.calcform.oz.value = roundnum(d*1e-9/0.45359237*16,6); }
function ConvertSt()
{ d = document.calcform.st.value;
if( d=='' ) return;
d = parseFloat(d);
document.calcform.ton.value = roundnum(d*14*0.45359237*1e-3,6);
document.calcform.kg.value = roundnum(d*14*0.45359237, 6);
document.calcform.gr.value = roundnum(d*14*0.45359237*1e3, 6);
document.calcform.mg.value = roundnum(d*14*0.45359237*1e6, 6);
document.calcform.mcg.value = roundnum(d*14*0.45359237*1e9, 6);
document.calcform.st.value = roundnum(d, 6);
document.calcform.lb.value = roundnum(d*14, 6);
document.calcform.oz.value = roundnum(d*14*16, 6); }
function ConvertLb()
{ d = document.calcform.lb.value;
if( d=='' ) return;
d = parseFloat(d);
document.calcform.ton.value = roundnum(d*0.45359237*1e-3, 6);
document.calcform.kg.value = roundnum(d*0.45359237, 6);
document.calcform.gr.value = roundnum(d*0.45359237*1e3, 6);
document.calcform.mg.value = roundnum(d*0.45359237*1e6, 6);
document.calcform.mcg.value = roundnum(d*0.45359237*1e9, 6);
document.calcform.st.value = roundnum(d/14, 6);
document.calcform.lb.value = roundnum(d, 6);
document.calcform.oz.value = roundnum(d*16, 6); }
function ConvertOz()
{ d = document.calcform.oz.value;
if( d=='' ) return;
d = parseFloat(d);
document.calcform.ton.value = roundnum(d/16*0.45359237*1e-3,6);
document.calcform.kg.value = roundnum(d/16*0.45359237, 6);
document.calcform.gr.value = roundnum(d/16*0.45359237*1e3, 6);
document.calcform.mg.value = roundnum(d/16*0.45359237*1e6, 6);
document.calcform.mcg.value = roundnum(d/16*0.45359237*1e9, 6);
document.calcform.st.value = roundnum(d/16/14, 6);
document.calcform.lb.value = roundnum(d/16, 6);
document.calcform.oz.value = roundnum(d, 6); }
</script>
</body>

</html>








Kontakt    Datenschutz   Impressum