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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:50
The file sales data.xlsx contains monthly sales amounts for 40 sales regions. write a sub that uses a for loop to color the interior of every other row (rows 3, 5, etc.) gray. color only the data area, columns a to m. (check the file colors in excel.xlsm to find a nice color of gray.)
Answers: 2
question
Computers and Technology, 22.06.2019 18:00
Which of the following physical laws can make the flow of water seem more realistic? a. motion b. gravity c. fluid dynamics d. thermodynamics
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
Which of the following tasks is an audio technician most likely to perform while working on a nature documentary? (select all that apply). eliminating potentially distracting background noise adding sound effects making sure the lighting is adequate for a particular scene changing the narration to better match the mood of the documentary
Answers: 3
question
Computers and Technology, 23.06.2019 12:50
Which syntax error in programming is unlikely to be highlighted by a compiler or an interpreter? a variable name misspelling a missing space a comma in place of a period a missing closing quotation mark
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, 21.01.2020 00:31
question
Social Studies, 21.01.2020 00:31
Questions on the website: 13722360