Mertegysgombvalto/amerikai.html
knyiharrolandjanos 8b1535c3ca 1.
2022-10-07 11:07:18 +02:00

87 lines
1.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mértékegység átváltó</title>
</head>
<body>
<form name='terfogat' style=' width: 320px; margin:32px auto; '>
<input type = 'text' name= 'pint' size=5
onFocus = 'document.terfogat.reset()'
onBlur = 'terfogat_szamol("pintből")' > pint
<input type = 'button' value=' <---> '
style = 'margin:24px;'>
<input type = 'text' name= 'liter' size=5
onFocus = 'document.terfogat.reset()'
onBlur = 'terfogat_szamol("literből")' > liter
</form>
<script>
function terfogat_szamol(mibol)
{
pint = parseFloat( document.terfogat.pint.value )
liter = parseFloat( document.terfogat.liter.value )
if( mibol=="pintből" && pint >0 )
{
document.terfogat.liter.value = pint * 0.473
}
if( mibol=="literből" && liter>0 )
{
document.terfogat.pint.value = liter / 0.473
}
}
</script>
<div class="row">
<div class=" col-4">
<input type="text">
<p>Hüvelyk</p>
<input type="text">
<p>Láb</p>
<input type="text">
<p>Yard</p>
<input type="text">
<p>Mérföld</p>
</div>
<div class="col-4">
<button>Számol</button>
</div>
<div class="col-4">
<input type="text">
<p>mm</p>
<input type="text">
<p>cm</p>
<input type="text">
<p>m</p>
<input type="text">
<p>km</p>
</div>
</div>
</body>
</html>