use JS to complete a simple calculator function. After you have entered an integer into the 2 input boxes, click on the third input box to give a subtraction of 2 integers. Effect as above:
The first step: Create the build Operation function count ().
Step two: Get the values in the two input boxes and get the value of the selection box.
Hint: document.getElementById (id name). Value Gets or sets the value of the ID name.
Step three: Get the value selected by the drop-down box to change the subtraction algorithm.
Tip: Use switch to determine the algorithm.
Fourth step: Call the Created function with the = button to get the result.
Note: use the parseint () function to parse a string and return an integer.
Code:
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Margin:0px;padding:0px;border:none; "/>
1 <! doctype html> 2 650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Margin:0px;padding:0px;border:none; "/>
JS to implement a simple calculator