在頁面佈局時,div+iframe能根據具體的大小進行佈局。但,對於iframe的適應大小,仍需js獲取內部html文件來改變。html
function reinitIframe(){
var iframe = document.getElementsByName("H_viewFrame")[0];//得到name爲H_viewFrame的iframe
try{
iframe.height = iframe.contentWindow.document.body.scrollHeight; 佈局
// iframe.height = iframe.contentWindow.document.documentElement.scrollHeight; //得到的高度根據頭部文件的不一樣而有所差別
}catch (ex){}
}
window.setInterval("reinitIframe()", 200);htm