View Full Version : Calling functions in different frames

08-07-2006, 11:39 PM
Hi, friends!

Take a look on the following problem:

I have two pages: functionPage.html and executionPage.html.

Here's the code of funcionPage.html:

function setImageSrc( path, obj )
obj.src = path;

<frame src="executionPage.html"></frame>

Now, here's the code of executionPage.html:

window.onLoad = parent.frames.setImageSrc( "/images/someImage.gif" document.getElementById("image") );
<img src="" id="image" />

As you guys can see, I have a main page that contains the funcion setImageSrc(), and inside this page I have a frame that loads the page executionPage.html.

Here's the problem: when I call the instruction parent.frames.setImageSrc(), I DO NOT want to reffer to an image positioned in the functionPage.html. I want that he reffers to the image stored in executionPage.html!!!
But calling funcions using parent.frames it seems that I cannot do this.

Is there another way that i could call a function with parent.frames, but reffering to elements of the page that is calling the function?

Or I have to make an include? I do not want to do it.... but I'm being forced to use it, i guess.

Anyone have an idea??

Thanks for the help, folks! :D

08-08-2006, 03:32 PM
window.onload = function(){
if (parent.setImageSrc) {
parent.setImageSrc("/images/someImage.gif", document.getElementById("image"));

08-09-2006, 10:37 PM

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum