Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Web (.html) page named evenNumbers.html and an external JavaScript (.js) file named whileLoop.js. In your external JavaScript file, create a while loop that

  1. Create a Web (.html) page named evenNumbers.html and an external JavaScript (.js) file named whileLoop.js. In your external JavaScript file, create a while loop that will write to your Web page every even number above 0 and below 101. These numbers should each appear on a new line. Hint: include a
    element in your document.write() function. In the BODY element of your Web page, create the script element that links your Web page to your external JavaScript file. Test your code.
  2. Create a Web (.html) page named ageChecker.html and an external JavaScript (.js) file named ifElse.js. In your external JavaScript file, use the prompt() function to gather the viewer's age. You may assume that the viewer will enter a number between 5 and 95. Don't forget to use the parseFloat function as you did in your last assignment to ensure that you populate your viewerAge variable with numeric data. Based on the viewer's age, create an if/else statement that will redirect the viewer to http://www.disney.com/ if they are under the age of 21. If they are 21 or older, redirect them to http://www.espn.com/. Test your code.

Hint: use the location property of the window object to redirect the viewer. Example: window.location = "http://www.espn.com/".

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

8. What topics should be avoided in workplace conversations?

Answered: 1 week ago