0
<div class="Er3">
<p> Α </p>
<form>Input a number <br><input type="n" id="er3"> </form>
<button onclick="QuestionThree()"> submit </button>
<p id="output"> </p>
<script> function QuestionThree() {
var y = document.getElementById("er3");
var o = parseFloat(y);
var n = o.toFixed(2);
var x = y - n;
var z = Math.abs(x);
document.getElementById("output").innerHTML = z;
}</script>
</div>
我已經打破了儘可能匹配的功能,但它仍然會返回nan而不是數字,爲什麼?函數將輸出nan而不是數字,爲什麼?
哪個函數調用返回nan? –
沒有輸入類型稱爲'n'將它切換到'number' – Endless
停止使用短變量 – Endless