[thelist] javascript:// :is it necessary?

The Optimizer chrism at puffofsmoke.net
Thu Jun 28 11:12:30 CDT 2001


> > <a href="products.htm" target="active"
> > onmouseover="images['imagename].src="
> > Button2.jpg"" onmouseout="images['imagename'].src="Button1.jpg"">
> > <img name="imagename" src="Button1.jpg" border="0" width="32"
> height="32">
> > </a>
>
> What do you mean by,
> It works (and it is still javascript)

What I meant was that it will change the image to another image without
generating any javascript errors.

> I don't have any JS functions or class or jars on the pages at
> all.  I seem

You have no javascript functions, but images[imagename].src is a javascript
reference, and "images[imagename].src = 'Button1.jpg'" is a javascript
statement. "images" is a javascript collection of all the javascript image
objects on the page. "imagename" references the javascript image object that
you wish to change the src property for. If you then specify a path to an
image you are then submitting a request to the server for that image. This
will then take a finite amount of time to download, depending on the image
size and connections speed. If you previously declared:

imageTwo = new Image(); imageTwo.src = "Button1.jpg";

And then used:

images[imagename].src = imageTwo.src

This would make sure that the image had been cached (when you declared the
second image object). However, it's still more efficient to come up with a
generic mouseover function.

> to not be understanding something here.  images[imagename].src is refering
> to the object on the page.  Is that JS?  Have I unwittingly been
> writing JS
> into my HTML mouseovers?

Yes and yes ;)

Let me know if you need any further clarification, and HTH.

Regards

Chris Marsh





More information about the thelist mailing list