August 9, 2011

Calling JS function from outside the iframe

Calling JS function from outside the iframe

Parent File:

<iframe src=”iframe.php” width=”100″ height=”100″ name=”iframName”></iframe>
<script language=”javascript” type=”text/javascript”>
function callFunc()
{
alert(‘Working!’);
}
</script>

Iframe File:

<a href=”#” onclick=”parent.callFunc();”>Click here</a>

Last updated: March 19, 2014