0

I have 2 function one in iframe and another one out of iframe.

I want to call outer function from inner[iframe] function.

Can anyone help me?

0

3 Answers 3

1

You can use the parent attribute to go up in levels, and to the holder of the iframe to call its functions.

Sign up to request clarification or add additional context in comments.

3 Comments

function foxbee() { obj = '<?PHP echo($objectName); ?>'; val = document.getElementById(obj).value; if(window.parent.beagod()) { alert("okay"); parent.beagod(); } else { alert("never"); } //document.parent.beagod(val); }
function respondToComment(comment) { if(comment.contains(code) && !(comment.contains(question) || comment.contains(remark))) { alert('I\'m not sure what you're trying to say here.'); }
parent.functionName() should do the trick. Are you certain that your JavaScript is being executed properly and that the function you're calling always returns true?
0

This is a good answered question about cross frame javascript function calling. Although the title mentions jQuery the answer is pure javascript

Comments

0

Answers relying on the parent object will only work if your iframes are hosted on the same domain. If going across domains, you'll need window.postMessage. The easyXDM library may provide the functionality you need in an easier to use (IE6/7 friendly) package, but I've never used it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.