Week 4 - 342v2.htm

<SCRIPT>

var Index = 0;

var logos = new Array();
if (
document.images) {
     logos[0] = new Image();
     logos[0].
src = "images/remedy.gif";

     logos[1] = new Image();
     logos[1].
src = "images/cisco.gif";

     logos[2] = new Image();
     logos[2].
src = "images/microsoft.gif";
}

var url = new Array();
url[0] = "http://www.remedy.com";
url[1] = "http://www.cisco.com";
url[2] = "http://www.microsoft.com";

var msg = new Array();
msg[0] = "Remedy - Leading Help Desk Provider";
msg[1] = "Cisco - Provding the Routers & Switch on which the Internet Runs";
msg[2] = "Microsoft - The Company Everybody Loves to Hate";

function showImage(sIndex) {
     Index = sIndex;
     if (!
document.images) return;
     document.logo.
src = logos[Index].src;
     document.
links[0].href = url[Index]
}

</SCRIPT>

The Body onLoad is necessary in order to reset the Select Menu. If this wasn't done the last Selected Item would remain when we return back to the page.

<BODY onLoad="document.companies[0].options[0].selected=true">

<FORM NAME="companies">
     <SELECT  onChange="showImage(selectedIndex)">
          <OPTION>Remedy</OPTION>
          <OPTION>Cisco</OPTION>
          <OPTION>Microsoft</OPTION>
     </SELECT>
</FORM>

<A HREF="http://www.remedy.com"
  onMouseOver="window.status = msg[Index]; return true;"
  onMouseOut="window.status=''">
<IMG NAME="logo" SRC="images/remedy.gif">
</A>