Changing Picture src with Javascript

I have a page with an Image on it. I created a Hotspot over it. Under the JS Header the following code:

var imgOut = new Image(75,100);

var imgOver = new Image(75,100);

imgOut.src = ‘Server.jpg’;

imgOver.src = ‘bender-angry.jpg’;

On my Picture under onMouseOut:

MainNav.Server.src = ‘imgOut.src’;

On my Picture under onMouseOver:

MainNav.Server.src = ‘imgOver.src’;

I have named my picture Server. When I show the page which is part of a frameset when I view it in a Notes Client. I am getting the error:

JaveScript Error during mouse event: ToObjectError: MainNav.Server has no properties

Does anyone have a clue what I am doing wrong. I am using Developer 6.5. I am new to Lotus Notes and if someone could point me in the right direction I would be very, very grateful.

Thank you in advanced.

Subject: Changing Picture src with Javascript

Bender angry? Bender furious!

I take it that MainNav is a frame. The full syntax to get to the image, then, would be:

top.MainNav.document.images[‘Server’].src = imgOver.src;

top points to the top-level window, then you go to the MainNav frame (assumes that MainNav lives in the top-level frameset), then you need to go through the document that is displayed in the frame, and finally through the images collection to get to the named image. Except for the quotes around imgOver.src, your code might have worked in Internet Explorer, because IE interjects a lot of assumptions into the object path (masking a lot of bad practices along the way – and there is an unfortunately large code base on the web that only works because IE masks the mistakes people made).

Subject: RE: Changing Picture src with Javascript

I put the line of code in that you gave me and it still doesn’t work. I can’t figure out where I am going wrong. Do you any other ideas?

Subject: RE: Changing Picture src with Javascript

Not without actually seeing what you’re doing. If you could create a new copy of the database (just the design), give default Manager access, and mail it to me, I can see what’s happening and make it work for you.