我寻找了一个 javascript 脚本,它将改变 iframe 的高度,根据其中加载的页面,我找到了一个代码,但它仅适用于 IE 和 FireFox.. 我应该改变什么?
<SCRIPT type="text/javascript" LANGUAGE="javascript">
function reSize()
{
try{
var oBody = ifrm.document.body;
var oFrame = document.getElementById("ifrm");
oFrame.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
}
//An error is raised if the IFrame domain != its container's domain
catch(e)
{
window.status = 'Error: ' + e.number + '; ' + e.description;
}
}
</SCRIPT>
iframe 代码:
<iframe width=940px onload=reSize() src="html/guides.html" id="ifrm" name="iframe_main" frameborder="0"></iframe>
感谢您的帮助!