display = document.getElementById('outputDiv');
display.innerHTML = 'Your Number Is: ';
function clear() {
document.getElementById("outputDiv").innerHTML = "";
}Run Code Online (Sandbox Code Playgroud)
<input type="button" value="Calculate" onclick="calculator()">
<input type="reset" value="Clear" onclick="clear()">
<div id="outputDiv"></div>Run Code Online (Sandbox Code Playgroud)
单击重置按钮后,我要删除display.innerHTML ='您的号码为:'+总计;