我们知道,iframe在传统的MVC项目里是个很常用的东西。

但这玩意用起来有时会有点烦人。

比如说:我有个一个页面套了一个iframe,iframe里面的页面通过a标签来切换。怎么做?

<li class="layui-nav-item"><a href="xxx" target="contextHomeIframe" ></a></li>
<iframe id="contextHomeIframe" name="contextHomeIframe" width="100%" scrolling="no" frameborder="0" src="xxx" style="margin-top: 10px;"></iframe>

猜猜看,target 找的是iframe的id还是name?

答案是name。

另外,父页面一般是不知道iframe的页面高度“应该是”多少的。

也就是说,你需要手动去设。

另外,在老IE和老safari上,关于iframe的DOM会和现代浏览器(chrome firefox)有些区别,需要考虑兼容性的问题。

相关文章:

  • 2021-12-10
  • 2021-05-19
  • 2022-01-03
  • 2021-05-23
  • 2022-12-23
  • 2021-12-04
  • 2021-05-20
  • 2021-11-26
猜你喜欢
  • 2021-06-12
  • 2021-10-16
  • 2021-05-22
  • 2021-07-11
  • 2022-12-23
  • 2022-01-29
相关资源
相似解决方案