体脂肪計算ツール
–
–
脂肪量(kg)
=
体重(kg)
×
体脂肪率(%)
除脂肪体重(kg)
=
体重(kg)
–
体脂肪量(kg)
function calculateBodyFat(){
const weight = parseFloat( document.getElementById("weight").value );
const bodyfat = parseFloat( document.getElementById("bodyfat").value );
if( isNaN(weight) || isNaN(bodyfat) ){
alert( "体重と体脂肪率を入力してください" );
return; }
/* 計算 */
const fatMass = weight * (bodyfat / 100);
const leanMass = weight - fatMass;
/* 表示 */
document.getElementById("fatMass") .innerText = fatMass.toFixed(1) + " kg";
document.getElementById("leanMass") .innerText = leanMass.toFixed(1) + " kg";
}
