function from frameset

A

Andrew Poulos

I have a function in a page in a frame. At the frameset I want to
replace the body of the function in the page with new content. How do I
refer to a function in a page in a frame from the frameset?

Andrew Poulos
 
M

Martin Honnen

Andrew said:
I have a function in a page in a frame. At the frameset I want to
replace the body of the function in the page with new content. How do I
refer to a function in a page in a frame from the frameset?

window.frames.frameName.functionName
 
S

SAM

Andrew Poulos a écrit :
I have a function in a page in a frame. At the frameset I want to
replace the body of the function in the page with new content. How do I
refer to a function in a page in a frame from the frameset?

To fire a function of a page in a named frame (ie: 'myFrame')

parent.myFrame.myFunction();

would work from any frame (and main page too)

If the frame is a child of another one :

top.myFrame.myFunction();


Now, to change the content of a function I don't know how to do.
 
A

Andrew Poulos

Martin said:
window.frames.frameName.functionName
Thanks for that. I thought that's what it was but it now means the
problem's to deep for me to follow.

The frameset is a HTA whereas the pages in the frameset are HTML. The
"main" frame's page has a number of OBJECT elements. I'm querying the
frame from the frameset to get each OBJECT and to then modify it (if
necessary).

Sadly it only keeps returning the first OBJECT in the page irrespective
of how many OBJECTs there actually are. Part of the code in the frameset
looks like this:

var doc = document.getElementById("mainFrame");

doc.onreadystatechange = function() {

if (doc.readyState == "complete") {
var pageDoc = window.frames.mainFrame.document;
var wmd = pageDoc.getElementsByTagName("object");
var wmdLen = wmd.length;
for (var i = wmdLen; i--;) {
tmp = wmd.getElementsByTagName("param")[0].value;
alert(i+"+"+tmp);
}
}

};

The alert will decrement the value of 'i' but the PARAM value never
changes. Its equal to the value of the first OBJECT even though there
are a number of different ones one the page. It seems like the
getElementsByTagName, in the loop, is only referencing the first OBJECT???

Andrew Poulos
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top