My JavaScript Calculator
The functioning calculator can be found on this page: http://schooladz.com/mosherq/javascript/final/jscalculator.html
The HTML
The HTML in this code is simple and relatively empty as it serves mainly as a container for the inputs and outputs of the calculator.
|
<!DOCTYPE html> |
#calcbox { |
The CSS
The CSS is more used but still simple as it simply makes the code look as it is.
|
JavaScript
The Variables
These variables contain data that makes the calculator work
: O is the output variable. IN1 is the first input variable. IN2 is the second input variable. FUN is the type of function set. And EDT is the variable that sets which input your editing. |
var O=0; |
function changeFUN(type) |
Functions
These are what actually runs the function:
The changeFUN function changes the type of function that will be run. The changeIN changes witch input is being edited. The clearAll function clears the calculator. The buttonIN function runs the button inputs and interprets them. And the calculatorRUN function runs the calculator with all of the data set. |