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: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:30
Ted wants to go out to a neighborhood park and shoot pictures of dew drops on grass. he wants to get a low-level angle of the dew drops. which support equipment should ted use? a. mini tripod b. pistol grip c. monopod d. body mount
Answers: 2
question
Computers and Technology, 22.06.2019 11:30
What do character formats do for your document's message? a.set the tone b.provide organization c.provide clarity d.set how texts align with documents
Answers: 2
question
Computers and Technology, 23.06.2019 19:30
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a,b] se pot scrie ca produs de două numere prime? “.
Answers: 1
question
Computers and Technology, 23.06.2019 21:20
In microsoft word, when you highlight existing text you want to replace, you're in              a.  advanced mode.    b.  automatic mode.    c.  basic mode.    d.  typeover mode
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.01.2021 19:10
question
Business, 28.01.2021 19:10
question
Mathematics, 28.01.2021 19:10
question
History, 28.01.2021 19:10
Questions on the website: 13722361