您当前位置: 首页 >  WEB技术 >  在框架页通过parent就可以对父窗口内元素进行操作。
2014/2/7 15:04:31 分类:WEB技术

在框架页通过parent就可以对父窗口内元素进行操作。

 在框架页通过parent就可以对父窗口内元素进行操作。

思路:
建两个普通HTML页,a.html 、b.html
## a.html code##

<input type="text" id="name" value="" />
<iframe src="b.html" width="100%" height="200"></iframe>
## b.html code##

<script type="text/javascript">
function fuck(){
parent.document.getElementById(\'name\').value=\'框架页向父窗口元素赋值!\';
}
</script>
这是被框架页面!

<input type="button" value="点我一下" onclick="fuck();" />

本文由胡金金个人网站整理发布,转载请注明地址:http://www.hujinjin.com/info/459.html

凡标明来源于胡金金个人网站的文章,皆为本站整理发布,若转载此文必须附原文链接,对部分平台更改其文内容当自己原创者,胡金金个人网站将保留其追究权利!
个人资讯推荐
友情链接