Homework Assignment 3

 MCS 170: The Nature of Computer Science

Due: Monday, February 20, at the beginning of class

  1. #4, 5, 8, 10, 11, 13, 19, 20, 22 on pages 56-57

  2. Create an HTML page that has a Javascript section with document.write statements to achieve the same effect as is shown in the following rendered HTML:

    Some text in italics and some in bold
    and some more underlined.

  3. Create an HTML page that has a Javascript section that uses the prompt statement to ask the user for his/her favorite cartoon character (stored as the variable "name") and then greet the user by saying "Hello name". 

  4. In JavaScript (and other programming languages) when a variable is assigned a value, that value overwrites any previous value of the variable. To illustrate this, create an HTML page that assigns a value to a variable and then replaces this value with a new value.  To accomplish this, create a page that 1) declares a variable "message", 2) assigns "message" an initial value, 3) displays the initial value of this variable, 4) assigns the variable a new value, and 5) displays this new value. The output from your page may look something like the following:
The initial value of message is MC170
The new value of message is LunchTime!

 Hand in your completed HTML pages as your answers for the previous three exercises.