Adding interactivity to web pages using JavaScript
$10-15 USD
Cancelled
Posted over 8 years ago
$10-15 USD
Paid on delivery
1. Open file sum_for_loop.html.
Write the code for the prompt method that gets the user entry. Add the code using for loop to sum numbers from 1 through the user’s entry. Display result in an alert box. The result should look similar to the following:
The sum of numbers from 1 to 5 is 15
User entry should be a number between 1 and 100.
Continue prompting user for number until the correct number (1-100) is entered.
Stop displaying the prompt box if user clicks Cancel.
2. Open file sum_while_loop.html.
Copy the code from sum_for_loop.html. Change the for loop to sum numbers 1 through entry into while loop.
The code should work the same way as the code that uses for loop.
3. Open file sum_do_loop.html.
Copy the code from sum_while_loop.html. Change the while loop to sum numbers 1 through entry into do while loop.
The code should work the same way as the codes that uses for loop and while loop.
4. Open file factorial.html.
Add the code that will calculate factorial of a number entered by user.
Example:
5! (five factorial) =1*2*3*4*5
Notes
JavaScript should be added to the head section of each .html file.
Each file should include comments with your name
Add all the files to the .zip folder and submit the .zip folder.