function heightSet(thisFrame) {
if ($.browser.mozilla || $.browser.msie) {
bodyHeight = window.frames["iframename"].document.body.scrollHeight;
} else {
bodyHeight = thisFrame.contentWindow.document.documentElement.scrollHeight;
//这行可代替上一行,这样heightSet函数的参数可以省略了
//bodyHeight = document.getElementById("thisFrameId").contentWindow.document.documentElement.scrollHeight;
}
document.getElementById("iframename").height = bodyHeight;
}<iframe id="iframename" name="iframename" frameborder="0" width="100%" onload="heightSet(this)" scrolling="no" src="getskip.aspx?proId=<%=proId %>"> //做的是一个分页,第一次加载的时候iframe下面部分和原网页会有一片空白,之后选择页数的时候就好了,谢谢!
1 iframe是用JS创建的还是页面上原来就有的2 iframe第一次加载时src是JS给的值(原来是src="")还是创建iframe的时候就有了的。