To Notes

IT 130 -- 3/10/10

 

Review Questions

  1. How do you change a CSS property using JavaScript?
     
    Ans: Take the property, say text-indent, remove the hyphen(s), and convert the capitalization to camel casing: textIndent. Then change it in JavaScript like this:
    document.getElementById(idnum).style.textIndent = 1cm;
     
  2. Which CSS property can make an element invisible?
    Ans: visibility.
     
  3. Guess how to change the page title dynamically.
    Ans: document.title = New Title;
     
  4. How do you change the text in an HTML element?
    Ans: document.getElementById(idnum).innerHTML = New text;

 

Final Website Project

 

Horizontal Navigation

 

A Centered Div Area

 

Image Rollovers

 

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.

 

Changing Background Color Dynamically

 

Hex Color Codes

 

Final Website Project