我有一个asp页面有一个iframe。我需要将自动高度设置为iframe。我在iframe sizing - cross browser issue 找到一篇文章,但它不能解决我的问题。 我的iframe是自动iframe高度
<iframe id="content" src=http://www.bc.com.au/news_manager/templates/?a=<%=request.QueryString("a")%>&z=<%=request.QueryString("z")%> width="908px" height="1000px" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" style="margin-left:auto; margin-right:auto;" ></iframe>
和ASP页上的代码是:
<script type="text/javascript">
window.onresize=resizeContentFrame;
resizeContentFrame();
function resizeContentFrame(){
setFrameHeight(documenent.getElementById('content'));
}
function setFrameHeight(f){
if(isDefined(f)){
alert('executing');
var h=document.documentElement.scrollHeight;
h-=(HEADER_HEIGHT+CONTENT_PADDING+5);
f.style.height=h+'px';
}
}
</script>
如果我不给iframe中一个固定的高度它只是切断iframe中的内容。
我在做什么错,而上面的脚本被标记为答案?
帮助...
是否在与包含文档不同的域上使用iframe内容? – 2010-07-30 09:58:45
是安迪... iframe内容来自不同的域 – Anil 2010-07-30 10:01:50