subject

You have successfully made a basic webpage calculator! Now that you’ve learned how to use HTML forms and write JavaScript functions, you are going to extend your calculator to include addition and subtraction. Log in to REPL. it and open your calculator program.
Using the web form that you’ve already created as your guide, add in two more buttons to your index. html file—one for addition and one for subtraction.
In your index. js file, create a function for addition and a function for subtraction. Make sure to call the functions correctly.
Test your new program. Did you get an incorrect value for the addition?
You may remember from Python that we sometimes have to convert strings to numbers in order to add them correctly. When you get the values from the text fields, they are automatically treated as strings. That’s not a problem for subtracting, multiplying, or dividing, but it is for addition because both strings get joined together. So, 3 + 5 becomes 35 instead of 8. To get around this, we’ll need to type cast the two variables to be integers using the built-in function parseInt() . Use parseInt() in this way:

num1 = parseInt(num1);

Code a similar line for num2 . Put both of them after you get their values from the text fields, and you should get a more correct result!

Add at least four CSS rules to your web form to make it look better. You might add in a background color, change the font size or style, change the color of the answer, or format the buttons. Check out this website for some ideas and tips on styling buttons:
https://www. w3schools. com/css/css3_buttons. asp
In order to change the style of the text fields, use the CSS selector input . To change the style of the buttons, use the CSS selector button . You could also give your calculator a fancy title—the sky’s the limit!
When you are finished, share the link to your webpage with your teacher by clicking on the share button and copying the link.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
Which type of file can be used to import data into a spreadsheet?
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Which analyst position analyzes information using mathematical models to business managers make decisions?
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Formatting rows and columns is similar to cell formatting. in an openoffice calc spreadsheet, you can format data entered into rows and columns with the of the rows and columns options. you can insert rows and columns into, or delete rows and columns from, a spreadsheet. use the insert or delete rows and columns option on the insert tab. alternatively, select the row or column where you want new rows or columns to appear, right-click, and select insert only row or only column options. you can hide or show rows and columns in a spreadsheet. use the hide or show option on the format tab. for example, to hide a row, first select the row, then choose the insert tab, then select the row option, and then select hide. alternatively, you can select the row or columns, right-click, and select the hide or show option. you can adjust the height of rows and width of columns. select row and then select the height option on the format tab. similarly, select column, then select the width option on the format tab. alternatively, you can hold the mouse on the row and column divider, and drag the double arrow to the position. you can also use the autofit option on the table tab to resize rows and columns.
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
In which view can you see speaker notes?
Answers: 1
You know the right answer?
You have successfully made a basic webpage calculator! Now that you’ve learned how to use HTML forms...
Questions
question
Mathematics, 28.12.2019 22:31
question
Mathematics, 28.12.2019 22:31
question
Spanish, 28.12.2019 22:31
question
Mathematics, 28.12.2019 22:31
Questions on the website: 13722360