Приглашаем посетить
Цветаева (tsvetaeva.lit-info.ru)

Workshop

Previous Page
Table of Contents
Next Page

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='flashing.gif';
onmouseout="flasher.src='button.gif'">
<img src="button.gif" alt="" id="flasher" style="border-style:none" /></a>

A2:

<a href="gohere.html"

onmouseover="flasher.src='flashing.gif'">
<img src="button.gif" alt="" id="flasher" style="border-style:none" /></a>

A3:

function rotateBanner() {

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


Previous Page
Table of Contents
Next Page