0
<!DOCTYPE html>
<html>
<body>
Please enter a number:<BR>
<input type="text" id="amount_input">
<button onclick="other_amount_input()">Submit</button>
<script>
var balance=502.73;
function other_amount_input() {
var input = document.getElementById("amount_input").value;
var new_total = parseInt(input) + balance;
alert("The amount deposited is: $" + input + ".00\n" + "This is the old balance: $" + balance + "\n" + "The new total is : $" + new_total);
}
</script>
</body>
</html>
我試圖讓HTML和JavaScript,其採用輸入(正數的輸入框,可以是一個小數,但只起到第100地方)我有網頁工作到哪裏將採取一個整數,並將其添加到一個硬編碼的數字,並顯示「hard_coded_number + input_number = output_number」的輸出
你的問題是什麼?當你弄清楚它是什麼時,可能將代碼作爲可運行代碼片段發佈? – RobG