在主页面中实现Iframe中的子页面的切换
1 在主页面中控制子页面的切换
在主页面中的代码以及DOM
<script type="text/javascript">
function changeUrl(url) {
document.getElementById("ifra_operation").src = url;
}
</script>
<div id="div_operation">
<iframe id="ifra_operation" src="A.aspx" runat="server"></iframe>
</div>
<input id="submit" onclick="changeUrl('B.aspx')"/>
2 在子页面中控制另一个子页面的切换
子页面C.aspx中
<script type ="text/javascript" >
function getUrl(url) {
var anotherFrame = top.parent.document.frames["ifra_operation"];
anotherFrame.location = url;
}
</script>
<input id="submit" onclick="getUrl('B.aspx')"/>