Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing Childen of an IFrame

Status
Not open for further replies.

jrottman

Programmer
Jun 17, 2005
47
We are working on a flex application, within this appliation, we are using an IFrame to display a page with FCKeditor on it.

The issue I am having is this, I am unable to hit any of the functions within the page we are load in the iframe. More or less I am not sure how to access the children of said IFrame.


This is the function that loads our IFrame.

index.html
function loadIFrame(url){
document.getElementById("myFrame").innerHTML = "<iframe id='myIFrame' src='" + url + "'frameborder='0'></iframe>";
}


This is the div we use to display out IFrame.
<div id="myFrame" style="position:absolute;background-color:transparent;border:0px;visibility:hidden;"></div>


This is function on the iframe page we are trying to hit.
function InsertHTML(param) {
alert("Message from Flex: " + param);

// Check the active editing mode.
if (oEditor.EditMode == FCK_EDITMODE_WYSIWYG) {
// Insert the desired HTML.
oEditor.InsertHtml(param);
} else {
alert('You must be on WYSIWYG mode!');
}
}
 
[1] This is a function in the index.htm.

[tt]function calliframefunction(fname,sparam) {
var oiframe=document.getElementById("myIFrame");
if (oiframe && oiframe.contentWindow && oiframe.contentWindow[fname]) {
document.getElementById("myIFrame").contentWindow[fname](sparam);
}
}[/tt]

[2] This is how you call insertHTML with some param from the index.htm, say using a button.
[tt]
<button onclick="calliframefunction('insertHTML','<div>hi there.</div>')">insert</button>
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top