[thelist] Thursday hint and question

martin at members.evolt.org martin at members.evolt.org
Thu Apr 12 17:47:50 CDT 2001


Have a look at http://www.lamaze.com

Mouse over the left hand nav table and
watch the background change.

Neat, eh..?

Here's how they seem to be doing it

In the HTML goes this:
   <td class=leftNavBg id=lnElem31 height=22 
onmouseover="toggleBG(1,'on');" onmouseout="toggleBG(1,'off');">

and in the JS (simplified a bit):

function getObject2(obj) {
   var myObj;
   myObj = eval("document." + coll + obj);
   return myObj;
}
function toggleBG(obj, flg) {
   if (!isIE) return;
   if (isIE4) return;  // IE4 has iframe flicker
   var myObj3 = getObject2("lnElem3" + obj);
   if (flg == "on") {
       myObj3.className='leftNavBgOn';
   } else {
       myObj3.className='leftNavBg';
   }
}

and in the stylesheet:
.leftNavBg    {background-color: #faf8f5;}
.leftNavBgOn  {background-color: #ffffce; cursor: hand;}



Could this have been simplified to:

   <td class=leftNavBg id=lnElem31 height=22 
onmouseover="this.className='leftNavBgOn';" 
onmouseout="this.className='leftNavBg';">

?

Cheers
Martin





More information about the thelist mailing list