以下代码有什么问题(我认为它与 if 语句有关),我尝试在网上查找它,但没有成功?
<form action="#" method="post" name="formSeven">
<p><input type="text" name="z11" value="" size="4" /> <span> Adjusted BMI </span></p>
<p><input type="text" name="z12" value="" size="4" /> <span> Age in years </span></p>
<p><input type="text" name="z13" value="" size="4" /> <span> Male or Female </span></p>
<p><input type="text" name="result7" value="" size="4" /> <span> BF% </span></p>
<p><input onclick="calculate7()" type="BUTTON" value="Calculate" /></p>
</form>
<script type="text/javascript">//
function calculate7() {
var x = document.formSeven.z11.value;
var y = document.formSeven.z12.value;
var z = document.formSeven.z13.value;
if (z == "Female"){
document.formSeven.result7.value = x+y-5.4;
}
else if (z == "Male") {
document.formSeven.result7.value = x+y-16.2;
}
}
// ]]></script>