Js Cal Explain
Js Cal Explain
HTML calculator:-
1. clearDisplay() = for clearing display after
calculation.
2. jaa(param)=for adding a value as param means
parameter which decide the button value &&& fix
the value of button.
3. calculateResult() = this function use to calculate all
sums.
OKAY??
➢ First function shown in figure describe how we enter the value
to our input by button
➢ document.getElementById('display').value += value;
Note: here is a onclick attribute which use to access or perform js functions to our
buttons okay??
➢ Second function shown in figure describe how we clear the value
from our input box.
<button onclick="clearDisplay()">C</button>
•Evaluates the mathematical expression in the value of the display element using eval().
•If successful, updates the display with the result and changes the background color to green.
•If there is an error during evaluation (e.g., invalid syntax), sets the display to "Error" and changes the background
color to red.
<button onclick="calculateResult()">=</button>
➢ Second function shown in figure describe how we clear the value from
our input box.