window.parent总结

window.parent说明 window.parent能获取一个框架的父窗口或父框架。顶层窗口的parent引用的是它本身.
可以用这一点特性来判断这个窗口是否是顶层窗口。如:
if(window.parent){
//内容
}
document.frames对象可以引用iframe里的页面,也可以引用frameset里的页面.
可以这样
document.frames[0].document.getElementById('xx');
可以这样
document.frames[0].document.body.innerHTML;
如何更新父窗体的数据?
用window.parent.document.getElemnetById('form1').text2.value=123
1、

<iframe id="tabFrame" name="tabFrame" marginwidth="0"marginheight="0" scrolling="no"
src="${pageContext.request.contextPath}/xxxx.do?method=xxxx" frameBorder="0"></iframe>
<iframe id="printTabFrame" name="printTabFrame"
width="100%" height=""
marginwidth="0" marginheight="0" scrolling="no" vspace="0"
src="${pageContext.request.contextPath}/xxx.jsp" frameBorder="0");"></iframe>
如果在xxx.jsp中需要获得xxxx.do的xxxx方法调转的页面中的数据,通过
window.parent.tabFrame.document.getElementById("id").value;
如果在xxx.jsp中获得父页面的内容
window.parent.document.getElementById("printTabFrame").src;
window.location.href和iframe的区别在于它们的作用和用途不同。 window.location.href是指当前窗口或标签页的URL地址。它可以用来获取或设置当前窗口的URL。通过设置window.location.href可以跳转到新的URL地址。例如,当用户点击一个链接或提交一个表单时,可以通过设置window.location.href来导航到新的页面。 而iframe是一种HTML元素,可以在一个页面中嵌入另一个页面。通过使用iframe,可以在一个页面中显示另一个页面的内容。使用iframe可以实现页面内的嵌套和加载外部页面等功能。当页面中存在iframe时,可以通过修改iframe的src属性来加载不同的页面内容。 总结来说,window.location.href用于管理当前窗口的URL地址,而iframe用于在页面中嵌入另一个页面的内容。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [关于js中window.location.href,location.href,parent.location.href,top.location.href的用法](https://blog.csdn.net/s13596191285/article/details/128459046)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [关于js中[removed].href,location.href,parent.location.href,top.location.href的用法与区别](https://download.csdn.net/download/weixin_38640984/13589277)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [详解js location.href和window.open的几种用法和区别](https://download.csdn.net/download/weixin_38683895/13681348)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值