CSci 1001 Lab 5: Javascript functions and events.

Work in pairs

Problem 1

Change the background-changing example to change the color of the page to some other color. Also change the text color of the page.

Problem 2

In the same example add an id to the h1 header and add code to the function to change the font to bold. The name of the font weight in Javascript is fontWeight. For more names of CSS properties in JavaScript see this resource.

Problem 3: disappearing pictures

For this problem you need to use a rollover of a picture with a "white square" picture to create an effect of appearing and disappearing picture.

Study the example of rollovers. Write a web page with two rollover pictures: one is initially invisible and suddenly "appears" when a mouse moves over it, and the other one is initially visible and suddenly "disappears" when the mouse moves over it. When the mouse moves away from the pictures, return them to the original state (the first one is visible, and the second one is invisible).

Use the pictures here:

It might be helpful to set the background of your page to a non-white color while getting this problem to work, and then reset it to white when you are done.

At the end of the lab


CSci 1001 course web site.