Do you have any advice for the issue at hand?
As a matter of fact, I do :)
function setup() {
var i;
for (i = 0; i <= 9; i++) {
document.getElementById(i).onclick = handleInput;
document.getElementById("operator_*").onclick = handleInput;
document.getElementById("operator_/").onclick = handleInput;
document.getElementById("operator_.").onclick = handleInput;
document.getElementById("operator_-").onclick = handleInput;
document.getElementById("operator_+").onclick = handleInput;
//var x;
document.getElementById("operator_=").onclick = evaluateInput;
}
}
function handleInput(e) {
var s = document.getElementById("display");
s.innerHTML += e.srcElement.childNodes[0].nodeValue;
}
function evaluateInput(e) {
var s = document.getElementById("display");
s.innerHTML = eval(document.getElementById("display").childNodes[0].nodeValue);
}
setup();