在主程序中用以下javascript
function calcIFrameHeight(id) {
//find the height of the internal page
var theHeight=
document.getElementById(id).contentWindow.
document.body.scrollHeight;
//change the height of the iframe
document.getElementById(id).height =
theHeight + 50;
}
在iframe中用
if (this.frameElement != null) window.parent.calcIFrameHeight(this.frameElement.attributes.id.value);