How to call a javascript function inside iframe from parent page

We call a javascript function which is inside the iframe from parent page.

d = document;
f = d.frames ? d.frames['frameName'] : d.getElementById('frameId');
p = f.document || f.contentWindow.document;

p.functionName();


functionName() is the javascript function to be called from parent.

Comments