Question: ( 10 p ) A customer wants to sum up all the numbers inside a string. Write the source code of an HTML page that

  1. (10p) A customer wants to sum up all the numbers inside a string. Write the source code of an HTML page that accepts the text(string) by a form element and then displays the grand total on the page via using a div (To calculate and display the grand total use JavaScript).

Sample:

if the input text is: There were 40 chickens, 5 cows, and 15 horses in the farm.

The output should be: 60

Hint: Think about split function or regular expressions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!