从iframe调用父窗口函数 [英] Calling a parent window function from an iframe
本文介绍了从iframe调用父窗口函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从iframe调用父窗口JavaScript函数。
I want to call a parent window JavaScript function from an iframe.
<script>
function abc()
{
alert("sss");
}
</script>
<iframe id="myFrame">
<a onclick="abc();" href="#">Call Me</a>
</iframe>
推荐答案
<a onclick="parent.abc();" href="#" >Call Me </a>
返回对当前窗口或子帧的父级的引用。
Returns a reference to the parent of the current window or subframe.
如果窗口没有父窗口,则其父属性是对自身的引用。
If a window does not have a parent, its parent property is a reference to itself.
当窗口加载到< iframe>
,< object>
或< frame>
,其父级是嵌入窗口元素的窗口。
When a window is loaded in an <iframe>
, <object>
, or <frame>
, its parent is the window with the element embedding the window.
这篇关于从iframe调用父窗口函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文