父页面里两个iframe之间互相访问
2009-05-09 08:54
429 查看
父页面里的代码里的两个iframe
<iframe id="frameLeft" height="100%" src="UserDeptLeft.htm">
</iframe>
<iframe id="frameRight" name="frameRight" src="Default.htm" height ="100%"></iframe>
左边的iframe 页里有控件:
<input type="hidden" id="moduleid" name="moduleid"/>
在右边的iframe访问左边的Iframe里的控件 moduleid
js 代码如下:
js代码如下:
<iframe marginheight="0" marginwidth="0" src="Default.aspx" frameborder="0" scrolling="no" width="100%" id="info_iframe" name="info_content" onload="change_size()"></iframe>
</body>
<head>
<script language="javascript">
function change_size()
{
document.getElementById("info_iframe").style.height=info_content.document.body.scrollHeight+1+"px";
}
</script>
</head>
防止被人frame
<SCRIPT LANGUAGE=JAVASCRIPT><!--
if (top.location != self.location)top.location=self.location;
// --></SCRIPT>
所谓自适应,是指iframe的高度,由iframe里的页面内容高度来决定,
并设置iframe的边框为0,
无滚动条, 这样就看不出iframe的真正的高度啦
上面的chang_size方法,应用不是太好,
又在网上查了资料
方法不错,放在blog里,为学习之用.
function TuneHeight() {
debugger;
var frm = document.getElementById("frameLeft");
var subWeb = document.frames ? document.frames["frameLeft"].document : frm.contentDocument;
if(frm != null && subWeb != null) {
frm.height = subWeb.body.scrollHeight;
}
<iframe id="frameLeft" width ="25%" height="100%" src="Left.htm" onload="TuneHeight()"></iframe>
<iframe id="frameLeft" height="100%" src="UserDeptLeft.htm">
</iframe>
<iframe id="frameRight" name="frameRight" src="Default.htm" height ="100%"></iframe>
左边的iframe 页里有控件:
<input type="hidden" id="moduleid" name="moduleid"/>
在右边的iframe访问左边的Iframe里的控件 moduleid
js 代码如下:
parent.frameLeft.window.document.getElementById("moduleid")
父页面访问左iframe里的控件 moduleidjs代码如下:
window.frames["frameLeft"].document.getElementById("moduleid")
网搜知识:IE7兼容Iframe高度問題及Iframe問題
<body><iframe marginheight="0" marginwidth="0" src="Default.aspx" frameborder="0" scrolling="no" width="100%" id="info_iframe" name="info_content" onload="change_size()"></iframe>
</body>
<head>
<script language="javascript">
function change_size()
{
document.getElementById("info_iframe").style.height=info_content.document.body.scrollHeight+1+"px";
}
</script>
</head>
防止被人frame
<SCRIPT LANGUAGE=JAVASCRIPT><!--
if (top.location != self.location)top.location=self.location;
// --></SCRIPT>
所谓自适应,是指iframe的高度,由iframe里的页面内容高度来决定,
并设置iframe的边框为0,
无滚动条, 这样就看不出iframe的真正的高度啦
上面的chang_size方法,应用不是太好,
又在网上查了资料
方法不错,放在blog里,为学习之用.
function TuneHeight() {
debugger;
var frm = document.getElementById("frameLeft");
var subWeb = document.frames ? document.frames["frameLeft"].document : frm.contentDocument;
if(frm != null && subWeb != null) {
frm.height = subWeb.body.scrollHeight;
}
<iframe id="frameLeft" width ="25%" height="100%" src="Left.htm" onload="TuneHeight()"></iframe>
相关文章推荐
- Windows Gadget不同的页面之间互相访问
- OnClientTriggerClick 两个页面之间互相传值
- 主页面与iframe的互相访问
- 【原创】iframe与父页面之间,变量、方法互相调用
- 跨域传值即主页面与iframe之间互相传值
- 当前窗口和Iframe之间的相互访问(图片上传成功后立刻显示在当前页面上)
- 解决同一页面中两个iframe互相调用jquery,js函数的方法
- web两个iframe之间互相调用方法
- 跨域传值即主页面与iframe之间互相传值
- 在两个页面之间互相写其控件内的值
- 两个Activity之间共享数据、互相访问的另一种方式的实现
- 父页面和iframe页面之间方法的互相调用
- JS备忘--子父页面获取元素属性、显示时间,iframe之间互相调用函数
- 相同域下,父页面和iframe之间方法和变量的访问
- 解决同一页面中两个iframe互相调用jquery,js函数
- Android编程实现两个Activity之间共享数据及互相访问的方法
- 解决同一页面中两个iframe互相调用jquery,js函数的方法
- 相同域下,父页面和iframe之间方法和变量的访问
- 使用到iframe的页面中父页面和子页面之间的访问
- web两个iframe之间互相调用方法