|
在框架页通过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