HTML

Using the Keyboard with a Web Page Calculator

In this fourth part of a six-part series on building a web page calculator, we'll delve more deeply into the functions. We start with the operator(ID) function, and then take a closer look at events. We'll wrap up by starting to show how to use the keyboard with the calculator.

//after the operation +, -, X and /, the display has to be cleared. We need for this the variable

var toClearDisplay = false;

I talked about these variables before. It suffices here to read the comments. I will come back to the global variables after I explain the operator() function. The operator function has two code segments.