Can't reference frame name when swapping image source?

  • Thread starter Thread starter awesterink
  • Start date Start date
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?
 
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';
 
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top