1:ifram的重要属性的src(路径和请求都需要加上协议,不然iframe加载不出来)
<div>
<h1 onclick="getIframe()">demo</h1>
<iframe class="mainbody" id="mainbody2" name="mainbody3" src="" scrolling="no" frameBorder="0" style="width:100%;height: 80%;">
</iframe>
</div>
<script type="text/javascript">
function getIframe() {
$("#mainbody2").attr("src","https://www.baidu.com");
}
</script>
2:object在HTML5中是一个简单的选择,功能和iframe类似
<object data="https://www.baidu.com" width="100%" height="100%" type="text/html">
</object>
3:embed在HTML5中是一个简单的选择,功能和iframe类似
<embed src="https://www.baidu.com" width="100%" height="100%" />