CS 110 Lab 11 - JavaScript Basics

Objective: learn how to create elementary JavaScript programs.

What to do?

Using the JavaScript program developed in class as an example, write a JavaScript program within an HTML page as follows:

  1. Display a button on the page that reads "Press to run the program".
  2. When this button is pressed, a confirm dialog box pops up asking the user "Are you sure?"; this dialog box contains two buttons: "OK" and "Cancel".
  3. If the user presses "Cancel" the program does nothing.
  4. If the user presses "OK" the program will do the following:
    1. Display a prompt dialog box asking the user to enter their full name.
    2. Display a prompt dialog box asking the user to enter what day of the week is it today.
    3. Display an alert dialog box displaying a message similar to the following: "Dear XXX, we are so happy to see you on such a wonderful YYY as today!", where XXX and YYY are the user's full name and the day of the week entered previously.

Save your work in an HTML file.

What to submit?

Use Blackboard Vista to submit the HTML file with your work.