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 15:40
Establish which of the following statements are true. (a) a sequence is convergent if and only if all of its subsequences are convergent. (b) a sequence is bounded if and only if all of its subsequences are bounded. (c) a sequence is monotonic if and only if all of its subsequences are monotonic.
Answers: 2
question
Computers and Technology, 23.06.2019 18:00
Freya realizes she does not have enough in her bank account to use the debit card. she decides to use a credit card instead. which questions should freya answer before using a credit card? check all that apply. can i pay at least the minimum payment each month? can i make payments on time and avoid late fees? will i have to take out a loan? how much in finance charges can i afford to pay? should i talk to a consumer credit counseling service?
Answers: 1
question
Computers and Technology, 24.06.2019 21:30
Aobject is used for displaying the results of a question based on stored data. a. query b. report c. table d. form
Answers: 2
question
Computers and Technology, 25.06.2019 08:10
A(n) is a step-by-step direction for performing a specific task, which is written in a language the computer can understand.servercachearrayprogram
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
Chemistry, 28.06.2019 03:10
question
Computers and Technology, 28.06.2019 03:10
Questions on the website: 13722360