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、
可以用这一点特性来判断这个窗口是否是顶层窗口。如:
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;