-1
每當我按下我的程序中的按鈕,它說最大的調用大小已超出,我不知道如何做我的程序運行。程序最大調用堆棧超過
這是代碼。
function check() {
var input = document.getElementById("num").value;
var check = /^[0-9]*$/;
check.test(input) ? window.alert("You have only entered numeric characters! Please proceed to press one of the other buttons.") : window.alert("Please enter only numbers!");
}
function abs() {
var abs_input = document.getElementById("num").value;
document.write("The absolute value of your number is: " + abs(abs_input));
}
function round() {
var input = document.getElementById("num").value;
document.write("The value of your number rounded is: " + round(input));
}
function log() {
var input = document.getElementById("num").value;
document.write("The natural logarithm of your number is: " + log(input));
}
<center>
<label style="font-size:40px">Please Enter A Number Here:</label>
<input type="text" id="num" style="font-size:40px">
<br />
<br />
<br />
<br />
<button type="button" onclick="check()" style="font-size:20px">Check</button>
<br />
<br />
<br />
<br />
<button type="button" onclick="abs()" style="font-size:20px">Absolute Value</button>
<br />
<br />
<br />
<br />
<button type="button" onclick="round()" style="font-size:20px">Rounded Value</button>
<br />
<br />
<br />
<br />
<button type="button" onclick="log()" style="font-size:20px">Log Value</button>
<br />
<br />
</center>
它因爲無窮的遞歸。你能解釋你想達到的目標嗎? – Rajesh