AutoCAD 3DMAX C语言 Pro/E UG JAVA编程 PHP编程 Maya动画 Matlab应用 Android
Photoshop Word Excel flash VB编程 VC编程 Coreldraw SolidWorks A Designer Unity3D
 首页 > JavaScript

Html中 IFrame的用法及注意点

51自学网 http://www.wanshiok.com
html,iframe,iframe使用注意

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使用及注意点,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对wanshiok.com网站的支持!


html,iframe,iframe使用注意  
上一篇:jquery自定义插件结合baiduTemplate.js实现异步刷新(附源码)  下一篇:浅析JavaScript的几种Math函数,random(),ceil(),round(),floor()