2016-12-06 6 views
0

Javascriptのテキストボックスの入力と簡単な数学は

<!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で入力ボックスを作成しようとしていますが、唯一の百分の場所に進することができ)私はそれは私がしなければならなかったすべてはparseFloatはへの変更のparseIntた全体数を取ると、ハードコード化された番号に追加し、「hard_coded_number + input_number = output_number」

+0

あなたの質問は何ですか?それが何であるかを考えてみると、コードを実行可能なスニペットとして投稿するのでしょうか? – RobG

答えて

0

で出力を表示する場所に取り組んでWebページを持っていますそれは私のために働いた

関連する問題