Calling JavaScript from the parent window
I am very new to JavaScript as well as JSP.
I have a JSP page. In that JSP page, I have one text box to enter the URL, submit
button and Extract
button. I also embedded iframe
in that JSP page. When I enter a URL in the text box and press submit
button, the page is loaded in the iframe
. It's working fine.
Now I would like to run anothe开发者_运维百科r JavaScript on the loaded iframe
(which has a web page) when pressing Extract
button. How can I do it? Please help me out in this issue.
try document.iframes[frameName].document.yourMethod() or document.iframes[frameName].yourMethod()
i guess you can do something like this in your iframe.
window.top.yourJS_Object.your_iframe_callback();
while yourJS_Object
can also be any method as well. it's just an example.
and to access the ifram:
window.frames.<frameName>.document.getElementById('result');
i.e.
but it has to be the same domain as far as i know.
精彩评论