PC Review


Reply
Thread Tools Rate Thread

Can't reference frame name when swapping image source?

 
 
awesterink
Guest
Posts: n/a
 
      29th Dec 2004
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?


 
Reply With Quote
 
 
 
 
MD Websunlimited
Guest
Posts: n/a
 
      29th Dec 2004
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" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
>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?
>



 
Reply With Quote
 
awesterink
Guest
Posts: n/a
 
      29th Dec 2004
Yup, that did the trick. Thanks!!!!


"MD Websunlimited" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>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?
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Image source drops web reference when saved in FrontPage 2002 =?Utf-8?B?a2FybmR0NTEwNA==?= Microsoft Frontpage 4 16th Nov 2005 10:16 PM
How to copy an MS Excel graphic from the system clipboard to an image control and obtain its source reference in .Net with either VB.Net or C# TC Microsoft VB .NET 0 25th Jul 2004 03:25 AM
How to copy an MS Excel graphic from the system clipboard to an image control and obtain its source reference in .Net with either VB.Net or C# TC Microsoft Dot NET 0 25th Jul 2004 03:25 AM
How to copy an MS Excel graphic from the system clipboard to an image control and obtain its source reference in .Net with either VB.Net or C# TC Microsoft Dot NET Framework 0 25th Jul 2004 03:25 AM
How to copy an MS Excel graphic from the system clipboard to an image control and obtain its source reference in .Net with either VB.Net or C# TC Microsoft C# .NET 0 25th Jul 2004 03:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:49 AM.