Can't reference frame name when swapping image source?

A

awesterink

I have 3 frames:
- mymenu
- mytitle
- mypage

In the 'mymenu' frame I can use an onclick function to change the source of
an image within that frame, for example, these all work:

<a href="clicked.htm" onclick="button.src='clicked.jpg';"><img name="button"
src="clickhere.jpg"></a>
<a href="clicked.htm" onclick="document.button.src='clicked.jpg';"><img
name="button" src="clickhere.jpg"></a>
<a href="clicked.htm" onclick="images['button'].src='clicked.jpg';"><img
name="button" src="clickhere.jpg"></a>
<a href="clicked.htm"
onclick="document.images['button'].src='clicked.jpg';"><img name="button"
src="clickhere.jpg"></a>


But if I try any of the following code to update an image in a specific
frame, it does not work:

<a href="clicked.htm" onclick="mymenu.button.src='clicked.jpg';"><img
name="button" src="clickhere.jpg"></a>
<a href="clicked.htm"
onclick="parent.frames['mymenu'].button.src='clicked.jpg';"><img
name="button" src="clickhere.jpg"></a>

What am I missing here?
 
M

MD Websunlimited

Hi Awesterink,

Ooops, sorry I had left off the document object in my original response.

It should be

parent.frames['main'].document.images['myimage'].src='newimage.gig';
 
A

awesterink

Yup, that did the trick. Thanks!!!!


MD Websunlimited said:
Hi Awesterink,

Ooops, sorry I had left off the document object in my original response.

It should be

parent.frames['main'].document.images['myimage'].src='newimage.gig';


--
Mike -- FrontPage MVP '97-'02
J-Bots 2004 102 Components For FP
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible

awesterink said:
I have 3 frames:
- mymenu
- mytitle
- mypage

In the 'mymenu' frame I can use an onclick function to change the source
of an image within that frame, for example, these all work:

<a href="clicked.htm" onclick="button.src='clicked.jpg';"><img
name="button" src="clickhere.jpg"></a>
<a href="clicked.htm" onclick="document.button.src='clicked.jpg';"><img
name="button" src="clickhere.jpg"></a>
<a href="clicked.htm" onclick="images['button'].src='clicked.jpg';"><img
name="button" src="clickhere.jpg"></a>
<a href="clicked.htm"
onclick="document.images['button'].src='clicked.jpg';"><img name="button"
src="clickhere.jpg"></a>


But if I try any of the following code to update an image in a specific
frame, it does not work:

<a href="clicked.htm" onclick="mymenu.button.src='clicked.jpg';"><img
name="button" src="clickhere.jpg"></a>
<a href="clicked.htm"
onclick="parent.frames['mymenu'].button.src='clicked.jpg';"><img
name="button" src="clickhere.jpg"></a>

What am I missing here?
 
Top