私は表示コンテンツを消去するときに問題があるJavascriptとImで簡単な電卓を構築しようとしています。JavaScriptの計算機のシンプルな明確な機能が動作しない
誰かが自分のコードを見て、なぜそれが動作していないのか教えてください。
なぜ表示値を空の文字列に設定しないのでしょうか。私は間違って何をしていますか?あなたたちにタンクしてください。
function testing(button){
var x = button.value;
document.getElementById("display").innerHTML+=x;
}
function clear() {
document.getElementById("display").innerHTML = "";
}
<body>
<input type="button" id="one" value="1" onClick="testing(this)">
<input type="button" id="one" value="2" onClick="testing(this)">
<input type="button" id="one" value="3" onClick="testing(this)">
<input type="button" id="clear" value="clear" onClick="clear()">
<h1 id="display"></h1>
</body>
感謝。 – Kingsfull123