0
私はこれが順番に コードを大幅に小さくする必要がある入力要素 のIDでモードを交換する必要が
function ValueLimit(min, max, mode){
var v;
if(mode === "h"){
v = document.getElementById("weight_imp").value;
if(v < min){document.getElementById("weight_imp").value = min;}
if(v > max){document.getElementById("weight_imp").value = max;}
}
if(mode === "w"){
v = document.getElementById("weight_imp").value;
if(v < min){document.getElementById("weight_imp").value = min;}
if(v > max){document.getElementById("weight_imp").value = max;}
}
}
私はいずれかを対象とすることができるはず を通してそれを渡すための方法を見つけるように見えることはできません要素関数のパラメータに要素IDを渡すにはどうすればよいですか? HTML/JS
私は何をあなたの提示を理解していません。より具体的にお願いしますか? –