To Notes

IT 130 -- 2/22/10

Review Questions

  1. What is the result of each of these JavaScript code fragments?
  2. What is a div tag?
     
    Ans: div tags delimit a section of a webpage to which CSS statements can be applied.
     
  3. What is absolute positioning?
     
    Ans: Absolute positioning means that div tags are positioned with respect to the upper left corner of the page using the left and top properties. This is in contrast with relative positioning, which positions a section with respect to the preceding section.
     
  4. What do the following HTML and CSS pages display in a browser?
     

  5. How do you make the text flow around an image?
     
    Ans: By using CSS statements float: left or float: right.

 

Using Repetition (While Loops)

 

Practice Problems

  1. What is the result of this JavaScript code fragment?
        var n = 1;
        while (n <= 20)
        {
            window.alert(n);
            n = n + 3;
        }
        
        Ans: 1
             4
             7
            10
            13
            16
            19
    
  2. Modify problem 3 to count backwards by sevens, starting at 1000.
    Ans: var n = 1000;
         while (n >= 0)
         {
             window.alert( );
             n = n - 7;
         }
    

 

Getting Webpages To and From the Server

 

Server Side Processing

 

A Menu with Hidden Submenus

 

JavaScript Examples for the Website Project

 

Project 6

 

Practice Problems

  1. Modify the Slide Show Example to:
     
    1. Show random images.
       
    2. Show a random image when the page is loaded. The image should not change until the page is reloaded.

 

More Examples with Buttons and Images

  1. Use a button to manually advance a slide show:
     

  2. Use the mousedown and mouseup events and two images to simulate pressing and releasing a button. Also incorporate the mouseover and mouseout events to change an image.
     

  3. Use a link instead of a button to advance the slideshow.
     

  4. Use a button instead of a link to change pages.
     

    To change the page with JavaScript, change the document.URL property.

 

Disappearing Acts and Other Magic Tricks

 

Changing Background Color Dynamically