iframe 根据内容自己调整高度宽度

function SetWinHeight(obj)
{
var win=obj;
if (document.getElementById)
{
if (win && !window.opera)
{
if (win.contentDocument && win.contentDocument.body.offsetHeight)
{
win.height = win.contentDocument.body.offsetHeight;
win.width =win.contentDocument.body.offsetWidth;
}
else if(win.Document && win.Document.body.scrollHeight)
{
win.height = win.Document.body.scrollHeight;
win.width=win.Document.body.scrollWidth;
}
}
}
}
</script>
</head>
<body >
<center>
<iframe id="idFrame" src="/member/" onload="Javascript:SetWinHeight(this)" height="768" frameborder=0 scrolling="no" ></iframe>

你可能感兴趣的:(JavaScript,Opera)