iframe自适应宽度和高度
提取自discuz并做了一些小修改.
$(document).ready(function setscreendiv() {
var clientHeight = 768;
var clientWidth=600;
var iframe = document.getElementById("main");
if (navigator.userAgent.toLowerCase().indexOf('opera') != -1) {
clientHeight = document.documentElement.clientHeight + 190;
clientWidth = document.documentElement.clientWidth - 180;
}
else {
clientHeight = document.documentElement.clientHeight - 55;
clientWidth=document.documentElement.clientWidth-180;
}
iframe.style.height = clientHeight + 'px';
iframe.style.width=clientWidth+'px';
document.documentElement.style.overflow = "hidden";
window.onresize = function () { setscreendiv(); }
window.onscroll = function () { setscreendiv(); }
}
)
ps:框架实在难以驾驭,目前项目后台已不采用框架方式。