div層里能嵌套框架或者新的html頁(yè)面嗎?
解答:1,基于jquery的DIV嵌套htmlhtml代碼:
<script src="js/jquery.js"></script>
<div id="btn" > 新頁(yè)面</div><div id="newDiv"></div>
js代碼:$(document).ready(function)(){ $("#btn").click(function(){ $('#newDiv').load('new.html'); });});
點(diǎn)擊“新頁(yè)面”即可實(shí)現(xiàn)添加2,基于純js代碼實(shí)現(xiàn)嵌套:html代碼:<button type="button" id="btn" onClick="javascript:load_home();" > 確認(rèn)</button>1
js代碼:function load_home() { document.getElementById("viewDiv").innerHTML = '<object type="text/html" data="new.html" width="100%" height="100%"></object>'; }