How do you calculate cumulative GPA in high school?

Here's the four table cell columns! So we have to define the table data tag <td> four times.
<Head> </ head>
<Form name = "calculator">
Disable <input type = "text" name = "display" id = "display">
</ TD>
</ T>
<td> <Input type = "button" name = "one" value = "1" onclick = "calculator_slap value = + 1 '"> </ td>
<td> <input type = "button" name = "two" value = "2" onclick = "calculator_.dplayplay.value + = '2'"> </ td>
<td> <Input type = "button" name = "three" value = "3" onclick = "calculator" display. Value = "'3" "> </ td>
<TD> <input type = "button" class = "operator" name = "plus" value = "+" onclick = "calculator_display.value + = '+'"> </ TD>
</ T>
</ Table>
</ Form>
</ Body>
</ HTML>
The first number in the <Td> tag is 1, the second is for 2 and the second. To create an input element button, type attribute must be set to the button.
Value attribute value = "" is displayed on the button that is also done.
Now click on the Function!
If you do not reach that, take a bottle bottle. You are eligible for that.
The octal function determines what happens when you click. This block executes the JavaScript code.
In this tutorial, I will not report detail about the onclick feature.
Essentially, the included code in the oncolic attribute only prompts the web browser to show how valuable the button is when you click on it.
The actual value of the input is fixed with + = (attached). If the current computer input is 5+ and 10 is clicked, 10 is added: there is "connected" symbol without 5 + 10, that is 15, number 10 is overwritten, and 10 appears on the computer screen.
For the third and fourth lines, the contents of the second horizontal segment should be repeated. The input value is also changed.
However, in the fifth line it will be a little different.
Why not?
The work is the same!
Function related to the onclick attribute restclick = "" is slightly different from the rest.
<Input type = "=" = "button" name = "dungeon" value = onclick = "calculator_isplay.value = eval (calculator_dplay.value.value)"> </ TD>
Eval (calculator. Display.value) is the value of input to interpret as javascript. So if the input is 4 + 6, then it will be evaluated as a javascript and 10 will return.
It was not difficult, now it was?
If all the individual components are found together, then we have a fully efficient (not attractive) calculator.
Source code is here
Yes, I did not say it was amazing. To make the calculator more attractive, the elements should be designed with CSS-Cascading Style Sheets.
Anyway, congratulations! You should now definitely drink in the second round of the beer.
Disclaimer: I do not smoke
Various possibilities are described in our next tutorial in the series how our HTML calculator can be designed.
Any questions? Comment section is yours
This website was created for free with Would you also like to have your own website?
Sign up for free