当前位置: 动力学知识库 > 问答 > 编程问答 >

jsp - 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 another 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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: