日期:2013-07-07  浏览次数:21042 次

iframe使用很普遍,通常的需求有两种:

1,获取iframe效果,就是带一个滚动条,可以省不少版面。
2,要嵌一个页面,实现框架链接。

如果不方便使用iframe,可以有如下处理方案:

第一种需求如果我们使用css规划来实现,即可以少一个页面,也可以提高效率。
第二种需求可以采用xmlhttp近程获取。

A. 直接模仿iframe

用层做容器

  援用:
#content { overflow:auto; height:200px; width:600px; background:#f00;}


效果演示源代码:

    [Ctrl+A 全部选择 提示:你可先修正部分代码,再按运转]

用body做容器

  援用:
html { overflow:hidden; height:100%; background:#fff; border:0;}
* html { padding:100px 0 0 100px;}
body { overflow:scroll; background:#f00; margin:0; position:absolute; top:100px; left:100px; bottom:0; right:0;}
* html body { height:100%; width:100%;}


效果演示源代码: