<iframe id="div_table_1" onMouseOver="this.style.display =''" onMouseOut="this.style.display = 'none';" height="300"  style="position:absolute; display:none;z-index:4"    scrolling=no  marginheight=0 marginwidth=0 border=0 frameborder=0></iframe>我现在height="300",如果不设,我动态添加的一部分内容显示不出来!

解决方案 »

  1.   

    display:none了之后就不能触发onMouseOver事件了
      

  2.   

    to duoduobaba(避雷针) :我用别的事件会让他显示出来的!
    这和我现在要问得问题无关!var strTable = getXml(xmlUrl);
        var doc = window.frames["div_table_1"].document;
    doc.open();
    doc.write(strTable);
    doc.close();
    table是这样加入的,可iframe不会根据table的大小自动调解大小!
       
      

  3.   

    height="100%"我已经试过了,比300还大!
      

  4.   

    让Iframe的高度及大小随帧内容的大小而自动改变
    一直以来,网上很多朋友都在提问这个问题。本人在参阅JS文档后,发现在这种效果是可以实现的。
    其实实现方法很简单:
    假设Parent.Asp 包含有一个名为 News 的Iframe.Asp,那么在Parent.asp我们如下设置
    <table border=1>
    <tr>
    <td id=iHeight>
    <iframe name="news" width=100%  height=100% src="Iframe.Asp" frameborder=no scrolling=no ></iframe>
    </td>
    </tr>
    </table>
    在Iframe.Asp里<body>写入如下代码:
    <body onload="parent.document.all.iHeight.height=this.document.body.scrollHeight+10;">
    通过以上即可达到Iframe的高度及大小随帧内容的大小而自动改变的效果,而不会影响你原来页面效果,非常方便!
      

  5.   

    自己解决了!我获取table的高度,再把它负值给iframe的height就可以了!
      

  6.   

    能不能问问
    var strTable = getXml(xmlUrl);
    里面的strTable返回的什么值?
      

  7.   

    var strTable="<table><tr><td>fff</td></tr></table>"
    就是这东东!
      

  8.   

    要是你加了10个表格呢?把height全加起来?
    还是应该用
    document.all.div_table_1.height=doc.body.scrollHeight
      

  9.   

    昏,用我的方法,管你什么height不height
      

  10.   

    to mackyliu(NB联盟--风流才子)
    我用你的方法好像没啥效果!
      

  11.   

    我的iframe里不是用src="Iframe.Asp"
    没有body这东西。
    我在strTable+="<body onload='parent.document.all.iHeight.height=this.document.body.scrollHeight+10;'>";
    strTable+.....
    var doc = window.frames["div_table_1"].document;
    doc.open();
    doc.write(strTable);
    没有效果!