JavaScript Assignment #6

Variables

Collect information from the user and store in a variable for later user.

  1. Create a basic page in html.
  2. Using a prompt box, prompt the user to supply his or her name.
  3. Save the name in a variable.
  4. Then, using a document.write() statement, use the information stored in variables to display Hello username! in big, bold letters, i.e. surrounded by <h1> tags.
  5. username should, of course, be what the user actually typed into the prompt box.

  6. Using the same variable, also display Hello username! in an alert message on the same page.
Final result: When the page loads, the user is prompted for his or her name. That name is then immediately displayed as Hello username! in an alert message, and then should immediately display as Hello username! in the page.

Next assignment ... Assignment #7