核心:使用jQuery技術
寬度:
$("#mainContent").css('width',$(window).width());
高度:onload="$(this).height($(this).contents().height())"
<iframe id="mainContent" scrolling="auto" name="mainContent" onload="$(this).height($(this).contents().height())" src="a.html" frameborder="0"/>
寬度和高度分别設定,百分百相容
本文轉自 沫沫金 51CTO部落格,原文連結:http://blog.51cto.com/zl0828/1030562,如需轉載請自行聯系原作者