Com Dot wrote:
In a frameset, the menu frame has six buttons. I would like to use
mouseOver on these buttons to make images change in another frame.
Does anyone have a script or know of a working site where this is used?
Any help is appreciated.
Thanks,
Com
There is a plethora of syntactical ways to do this, but logically
they're all pretty much the same:
Use the document.frames collection to identify the frame you'd like to
address, then work with it as you would any other window.
You might want to Google it or find JavaScript and DOM documentation
that pleases you. There are also many excellent tutorials out there
that you may find valuable.
Some generic examples follow:
document.frames[ myFrame ].document.images[ myImage ].src =
'images/aPicture.pic';
------
with( document.frames[ myFrame ] ) {
document.images[ myImage ].src = 'images/aPicture.pic';
// other things you want to do in the frame
}
------
pictureFrame = document.frames[ myFrame ];
pictureFrame.document.images[ myImage ].src = '...';
------
picture = document.frames[ myFrame ].document.images[ myImage ];
picture.src = '...';
------
You may also (in some cases) refer to the frame directly, though this
is bad practice:
<frame name=PictureFrame id=PictureFrame ... />
PictureFrame.document.images[ myImage ].src = '...';
------
Alternative to the document.frames and document.images collections, you
may use the document.getElementById method. Don't, though.
Again, there's a wealth of excellent tutorials out there.