Workshop


The workshop contains quiz questions and activities to help you solidify your understanding of the material covered. Try to answer all questions before looking at the "Answers" section that follows.

Quiz

1:

Say you've made a picture of a button and named it button.gif. You've also made a simple GIF animation of the button flashing green and white and named it flashing.gif. Write the HTML and JavaScript code to make the button flash whenever someone moves the mouse pointer over it, and link to a page named gohere.html when someone clicks the button.

2:

How would you modify what you wrote for question 1 so that the button starts flashing when someone moves the mouse over it, and keeps flashing even if he or she moves the mouse away?

3:

Write the HTML code for a JavaScript function that displays five banner ads with a four-second delay between each one. The ID of the banner <img> tag is mybanner, and the banner images themselves are named banthis1.jpg, banthis2.jpg, and so on.

Answers

A1:

 <a href="gohere.html" onmouseover="flasher.src='/books/4/158/1/html/2/flashing.gif'; onmouseout="flasher.src='/books/4/158/1/html/2/button.gif'"> <img src="/books/4/158/1/html/2/button.gif" alt=""  style="border-style:none" /></a> 


A2:

 <a href="gohere.html" onmouseover="flasher.src='/books/4/158/1/html/2/flashing.gif'"> <img src="/books/4/158/1/html/2/button.gif" alt=""  style="border-style:none" /></a> 


A3:

 function rotateBanner() {   if (++bannerNum > 5)     bannerNum = 1;   document.getElementById("mybanner").src = "banthis" + bannerNum + ".jpg";   window.setTimeout('rotateBanner();', 4000); } 





SAMS Teach Yourself HTML and CSS in 24 Hours
Sams Teach Yourself HTML and CSS in 24 Hours (7th Edition)
ISBN: 0672328410
EAN: 2147483647
Year: 2005
Pages: 345

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net