执行顺序的问题,执行到
<iframe>的时候,两个页面应该是同时加载的,这个时候有一个块一个慢就会有时候灵,有时候不灵
写在onload事件里试试看还有没有问题

解决方案 »

  1.   

    我改成这样也是一样的:<script>
    function height()
    {
      window.parent.document.all.div_poll.style.height=document.body.scrollHeight;
    }
    </script>
    <body onload="height()">
      

  2.   

    是<div>没加载完
    改成这样呢
    <div id="div111" align="center"><IFRAME id="List" style="WIDTH: 90%" border="0" name="List" arginWidth="0" frameSpacing="0" marginHeight="0" src="pages/onlinepoll/default.aspx" frameBorder="0" noResize width="100%" scrolling="no" height="100%" vspale="0" align="middle"></IFRAME>
    </div>
    <script language=javascript>
         document.getElementById("div111").height=List.document.body.scrollHeight;
    </script>
      

  3.   

    you can visit www.linux-desktop.org to look at its page source, which contains javascript for this funcion.
      

  4.   

    父框架中的单元格中的:
    <div id="div111" align="center"><IFRAME id="List" style="WIDTH: 90%" border="0" name="List" arginWidth="0" frameSpacing="0" marginHeight="0" src="pages/onlinepoll/default.aspx" frameBorder="0" noResize width="100%" scrolling="no" height="100%" vspale="0" align="middle"></IFRAME>
    </div>
    pages/onlinepoll/default.aspx中有:
    <body></body>后有:
    <script>
         window.parent.document.all.div111.style.height=document.body.scrollHeight;
    </script>
      

  5.   

    父框架中的单元格中的:
    <div id="div111" align="center"><IFRAME id="List" style="WIDTH: 90%" border="0" name="List" arginWidth="0" frameSpacing="0" marginHeight="0" src="pages/onlinepoll/default.aspx" frameBorder="0" noResize width="100%" scrolling="no" height="100%" vspale="0" align="middle"></IFRAME>
    </div>
    pages/onlinepoll/default.aspx中有:
    <body></body>后有:
    <script>
         window.parent.document.all.div111.style.height=document.body.scrollHeight;
    </script>
      

  6.   

    <script language="javascript">var getMSIEIndex = navigator.userAgent.indexOf("MSIE");
    var getOperaIndex = navigator.userAgent.indexOf("Opera");
    var isMSIE = false;
    var isOpera = false;
    if (getMSIEIndex > -1)
    {
        isMSIE = true;
    }
    if (getOperaIndex > -1)
    {
        isOpera = true;
    }var extraHeight = 32;function dyniframesize(iframename)
    {
        var pTar = null;    if (document.getElementById)
        {
            pTar = document.getElementById(iframename);
        }
        else
        {
            eval('pTar = ' + iframename + ';');
        }    // Deal with MSIE browser.
        if (isMSIE && !isOpera)
        {
            if (pTar.Document && pTar.Document.body.scrollHeight && pTar.Document.body.scrollWidth)
            {
                //ie5+ syntax
                pTar.height = pTar.Document.body.scrollHeight + extraHeight;
                pTar.width = pTar.Document.body.scrollWidth;
            }
        }
        // Deal with opera browser.
        else if (isOpera)
        {
            if (pTar.contentDocument && pTar.contentDocument.body.scrollHeight && pTar.contentDocument.body.scrollWidth)
            {
                //ns6 syntax
                pTar.height = pTar.contentDocument.body.scrollHeight + extraHeight;
                pTar.width = pTar.contentDocument.body.scrollWidth;
            }
        }
        // Deal with mozilla or firefox browser.
        else
        {
            if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight && pTar.contentDocument.body.offsetWidth)
            {
                //ns6 syntax
                pTar.height = pTar.contentDocument.body.offsetHeight + extraHeight;
                pTar.width = pTar.contentDocument.body.offsetWidth;
            }
            else
            {
                //ns6 syntax: because sometimes
                //pTar.contentDocument.body.offsetHeight will be 0.
                //So here we will set pTar.height and pTar.width with
                //pTar.contentDocument.documentElement.offsetHeight
                //and pTar.contentDocument.documentElement.offsetWidth
                //respectively.
                pTar.height = pTar.contentDocument.documentElement.offsetHeight;
                pTar.width = pTar.contentDocument.documentElement.offsetWidth;
            }
        }
        
    }</script>
      

  7.   

    pTar = document.getElementById(iframename);  // get iframe nodepTar.height = pTar.Document.body.scrollHeight + extraHeight;     // set iframe height as scrollheight of its body document.
    pTar.width = pTar.Document.body.scrollWidth;                             // set iframe width as scrollwidth of its body document.the same to other code.