To Notes

IT 130 -- 11/4/08

 

Review Questions

  1. What is the output?

    var a = 5, b = 8, c;
    c = b + 3 * a;
    b = 2 * b + c;
    a = 3 * b;
    document.write("<p> + (a + c) + </p>");
    
    Answer: Variable Trace
    a b c
    5 8 23
    117 39  
    Output: 140

  2. Write code for a dropdown menu that displays the items "Beef", "Chicken", "Vegetarian". The corresponding values are "1", "2" and "3". The name of the dropdown menu should be ddmMealChoice.

    Ans:

    <select name="ddmMenu">
    <option value="1">Beef</option>
    <option value="2">Chicken</option>
    <option value="3">Vegetarian</option>
    </select>
    
  3. Write a JavaScript statement that assigns the currently displayed item in ddmMealChoice in the textbox txtMealChoice.

    Ans:

    document.frmMenu.txtMealChoice.value = 
        document.frmMenu.ddmMenu.value
    
 

Structured Programming

 

Using Decision (If Statements)

 

Practice Problem

 

Using Repetition (While Loops)

 

Radio Buttons