页面a.php : <iframe id="a" name="a" src="b.php" scrolling="no" frameborder="5px" width="100%" height="100%"></iframe>
页面b.php: <iframe name="b" src="c.php" scrolling="no" frameborder="5px" width="100%" height="100"></iframe>
页面c.php 如何才能自适应高度
页面b 中没有ID属性啊

解决方案 »

  1.   

    动态设置一下高和宽嘛$("iframe[name='b']").css({
                height: $(document).height() + 'px',
                width: $(document).width() + 'px'
            });
      

  2.   

    iframe[name='b']加载完毕后执行下列代码,两次执行,第一次页面加载ready(),第二次是图片加载load()var thisHeight=$(document).height();
    var thisWidth=$(document).width();
    //iframe出了css的width还有width属性,因此把iframe的高度赋值给父级页面的iframe标签
    top.$("iframe[name='b']").height(thisHeight).attr("height",thisHeight)
    top.$("iframe[name='b']").width(thisWidth).attr("width",thisWidth);