实现 iframe 子页面调用父页面中的js方法
2013-11-04 10:54
369 查看
父页面:index.html(使用iframe包含子页面child.html)
[xhtml] view plaincopyprint?
<html>
<head>
<script type="text/javascript">
<!--
function toshow(msg){
alert("这里是父页面:"+msg);
}
// -->
</script>
</head>
<body>
<iframe background="blue" src="child.html" mce_src="child.html"></iframe>
</body>
</html>
子页面child.html(调用父页面toshow方法)
[xhtml] view plaincopyprint?
<html>
<head>
<script type="text/javascript">
<!--
function doparent(){
window.parent.toshow('ccccchild');
}
// -->
</script>
</head>
<body>
This is child frame!!
<input type="button" value="请点击" onclick='doparent()'></input>
</body>
[xhtml] view plaincopyprint?
<html>
<head>
<script type="text/javascript">
<!--
function toshow(msg){
alert("这里是父页面:"+msg);
}
// -->
</script>
</head>
<body>
<iframe background="blue" src="child.html" mce_src="child.html"></iframe>
</body>
</html>
子页面child.html(调用父页面toshow方法)
[xhtml] view plaincopyprint?
<html>
<head>
<script type="text/javascript">
<!--
function doparent(){
window.parent.toshow('ccccchild');
}
// -->
</script>
</head>
<body>
This is child frame!!
<input type="button" value="请点击" onclick='doparent()'></input>
</body>
相关文章推荐
- js调用iframe实现打印页面内容的方法
- js调用iframe实现打印页面内容的方法
- JavaScript实现内嵌的iframe跨域调用父页面js方法
- iframe里面的页面调用父窗口,左右窗口js函数的方法
- Shtml完美解决静态页面内部调用其他页面(非Iframe、Object、Js方法)
- iframe里面的页面调用父窗口,左右窗口js函数的方法
- IFrame下子页面调用父框架的JS方法
- javascript中iframe里面的页面调用父窗口js函数的方法。
- 解决同一页面中两个iframe互相调用jquery,js函数的方法
- javascript中iframe里面的页面调用父窗口js函数的方法。
- 在iframe中调用js父页面和子页面方法
- iframe父子页面相互调用js方法
- jquery 调用iframe页面中js的方法 兼容Ie,FF,chore浏览器
- iframe里面的页面调用父窗口,左右窗口js函数的方法
- iframe中的js如何调用父页面中模块化好的脚本中的方法?
- js中iframe调用父页面的方法
- js防止页面被iframe调用的方法
- js将iframe中控件的值传到主页面控件中的实现方法
- 实用js小汇总--获取iframe引用的页面中的控件ID,或赋值的实现方法
- JS 互相调用iframe页面中js方法、VUE里 iframe 互调方法