[thelist] Wanted: the definitive fool-proof mouseover JavaScript

James Aylard webmaster at equilon-mrc.com
Wed Jun 27 16:08:11 CDT 2001


Paola,

> ... And since this new script
> stops IE3 error messages with only an extra 30 bytes (compared
> to testing for document.images), I think it's a better
> alternative.

    I'm not sure I understand why testing for document.images would make
your script larger than it currently is. By my estimate, it would be
smaller, for a couple of reasons:

* You can eliminate the first script block altogether
* You can eliminate the "1.1" bit from the second script language attribute

    In place of that, you would need to edit your two functions like so:

function img_inact(imgName)
{
  if (document.images) {
    imgOff = eval(imgName + "off.src");
    document [imgName].src = imgOff;
  }
}

    The cost of doing this is more than offset by eliminating the
unnecessary script block. If you're really interested in conserving every
byte possible, replace your spaces with tabs -- in terms of byte size, one
tab = one space.

James Aylard





More information about the thelist mailing list