IE8的div中使用Iframe出现下拉框形式,而IE7却没有

来源:互联网 发布:虚拟歌姬软件多少钱 编辑:程序博客网 时间:2024/05/21 17:07

1、在使用IE7浏览器时的的iframe没有出现边框,在IE8则出现了,解决方法:

IE8调用IE7的渲染模式:

head中加入<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>或者<meta http-equiv="x-ua-compatible" content="ie=7" />

设置iframe的相对属性:

<div id="page" name="page"   style="clear:both; position:relative;"> 
<iframe id="pagefmain" name="pagefmain" src="/esult.jsp" style="overflow:auto;top:0px;" frameborder="0" width="100%" height="100%" onload="autoHeight(this)"></iframe>
</div> 


//调整体高度, 自动,第一次加载时有用
function autoHeight(iframe){
//var iframe = document.getElementById('pagefmain');
if(iframe.Document){//ie自有属性
iframe.style.height = iframe.Document.documentElement.scrollHeight;
//document.getElementById('rightFrame').style.height=parseInt(iframe.style.height)-5;
//document.getElementById('rightFrame').contentWindow.initPageSize();//处理不同分辨率实时切换时自动切换大小
}else if(iframe.contentDocument){//ie,firefox,chrome,opera,safari
iframe.height = iframe.contentDocument.body.offsetHeight;
}
//alert('加载完后_iframe.style.width='+iframe.style.width+',height='+iframe.style.height);
}

0 0
原创粉丝点击