+ -
当前位置:首页 → 问答吧 → 求教 如何控制iframe的高度

求教 如何控制iframe的高度

时间:2011-05-07

来源:互联网

width:200px调到超过300边缘就显示空白了。。。这是为什么啊。。请高人啊。。

<script>
(function(d){
 var iframe = d.body.appendChild(d.createElement('iframe')),
 doc = iframe.contentWindow.document;
 // style the iframe with some CSS
 iframe.style.cssText = "position:absolute;width:200px;height:100px;left:0px;";

 doc.open().write('<body onload="' +
 'var d = document;d.getElementsByTagName(\'head\')[0].' +
 'appendChild(d.createElement(\'iframe\')).src' +
 '=\'\/path\/to\/file\'">');

 doc.close(); //iframe onload event happens
 })(document);
</script>

作者: 天生好人   发布时间: 2011-05-07

不知道啊,帮顶一下吧

作者: 污泥中的犀牛   发布时间: 2011-05-07