WDV221 Intro Javascript

Style Object - CSS Interactions - Homework 9


Please make the following effects to this page. Please activate the funcion with a button unless otherwise indicated. When complete post this page to your server and update your homework page.

1. Create a function that will center the heading "Style Object - CSS Interactions" when you mouseover it. The function should also change the font color and background color. Return it to its original state when the mouse leaves the heading.

2. Create a function that will ask the user for a font size. If the font size is greater than 50 or less than 10 display an alert with the following message "Incorrect size choice". If it is a valid font size change the font of this paragraph to the requested size.

To change the font size of the above paragraph, enter a number between 10 - 50 here."

3. Create a generic function that will change the background color of this paragraph. The following buttons will call the same function and pass in the requested color.

4. Create a function called timeGreeting( ). This function will change the "Greeting" based upon the time of day: morning, afternoon, evening. Change the font face, color, size and background to corresponding to the time of day.

5. Create a function that will ask the user for one of the following colors: blue, green, yellow, orange. If the user enters an invalid color display a message and change the color of all the following paragraphs to red. Otherwise change the color of the indicated paragraph using the same generic function for each paragraph. Example: User enters green then change the green paragraph to green text, etc.

This is blue!

This is green!

This is yellow!

This is orange!

To change the line or word color, enter one of the 4 colors above."

Extra credit: In 5. Instead of changing the whole paragraph only change the color name. Example: When blue change only the word blue in the paragraph.