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、子页面的使用,子页面,在调整大小后,可以调用父页面的setwinheight就可用把布局弄好看了。
if (window.parent.setwinheight) window.parent.setwinheight();
以上所述是小编给大家介绍的html之 iframe使用及注意点,希望对大家有所帮助
如对本文有疑问, 点击进行留言回复!!
JS 浅拷贝——Shallow copy 在 Canvas 绘图中的应用
网友评论