0x01 iframe的跳出框架
0x02 iframe樣式設置
0x03 iframe重置高度
1、首先來一個,跳出iframe的好方法,直接可以在Login.aspx頁面使用。
if (window.parent.[IFRAME外殼的某方法]) { top.location.href = "Login.aspx";}
2、再來段比較好看的iframe
<script type="text/javascript"> function SetWinHeight() { var obj = document.getElementById("content"); var win = obj; if (win && !window.opera) { if (win.contentDocument && win.contentDocument.body.offsetHeight) win.height = win.contentDocument.body.offsetHeight + 20; else if (win.Document && win.Document.body.scrollHeight) win.height = win.Document.body.scrollHeight + 20; } } window.onresize = function () { SetWinHeight(); }</script><div class="page-body"> <iframe id="content" src="None.aspx" name="content" onload="javascript:SetWinHeight()" frameborder="0" scrolling="auto" style="min-height: 700px;" height="100%" width="100%"></iframe></div>
3、子頁面的使用,子頁面,在調(diào)整大小后,可以調(diào)用父頁面的SetWinHeight就可用把布局弄好看了。
if (window.parent.SetWinHeight) window.parent.SetWinHeight();
以上所述是小編給大家介紹的Html之 IFrame使用及注意點,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網(wǎng)網(wǎng)站的支持!
新聞熱點
疑難解答