View Full Version : how to call function from iframe and from iframe to back again
pankaj.ghadge
01-05-2009, 11:36 AM
hello
how to call javascript function from iframe to normal page (that has included iframe) and from normal page to iframe.
please replay .........
Snookerman
01-05-2009, 11:43 AM
This might be helpful:
http://www.htmlforums.com/client-side-scripting/t-calling-javascript-function-from-iframe-in-ie-99847.html (http://www.htmlforums.com/client-side-scripting/t-calling-javascript-function-from-iframe-in-ie-99847.html)
codeexploiter
01-05-2009, 12:24 PM
The following code calls the function that exists in the main window from the iframe window
if(typeof parent.window !== 'undefined' && typeof parent.window.functionName === 'function'){
functionName(); //Call the function only if it exists
}
The following code calls the function that exists in the iframe window from the main window
if(typeof document.frames['iframeName'] !== 'undefined' && typeof document.frames['iframeName'].functionName === 'function'){
document.frames['iframeName'].functionName(); //Call the function available in the iframe window from the parent window.
}
Please note that here the functionName can be replaced with the function names that you want to access. I've used a dummy name like this to convey the idea.
Hope this helps.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.