那第二个页面得是你在第一个页面中window.open的<html>
<script>
function init() {
  var mywin = window.open("about:blank", "");
  alert(mywin.document.body.clientWidth);
}
window.onload = init;
</script>
</html>

解决方案 »

  1.   

    document.body.scrollWidth得到页面内容的宽度
      

  2.   

    当然可以!<body id=xh topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>
    <table width=400 height=200>
    <tr>
    <td>
    测试测试试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试
    </td>
    <tr>
    </table>
    <script>
    alert("本页页面的宽和高[不是窗口的宽高]分别是:"+document.all.xh.scrollWidth+","+document.all.xh.scrollHeight)
    </script>
    </body>  
      

  3.   

    是这样的,我想在一个页面main.htm中包含另外两个页面1.htm和2.htm,于是我用了下面的方法,这是页面main.htm中的内容:
    <iframe  id="page1" name ="page1" src="1.htm" frameborder=0 scrolling=no width='100%' height=???></iframe>
    <iframe id='page2' name='page2' src="2.htm" frameborder=0 scrolling=no width='100%' height=???></iframe>
    现在我希望页面main.htm中所显示出来的1.htm和2.htm都是整页显示,请问这个高度应该填什么,还有在页面1.htm和2.htm中不能有任何的程序.
      

  4.   

    这样写可以满足你的要求:
    main.htm
    ==============================================================================
    <HTML>
    <iframe id ="page1" src="1.htm" frameborder=0 scrolling=no width='100%' height=0></iframe>
    <iframe id='page2' name='page2' src="2.htm" frameborder=0 scrolling=no width='100%' height=0></iframe>
    </HTML>
    1.htm
    ==============================================================================
    <HTML>
    <body topmargin=0 bottommargin=0 marginheight=0 onload="parent.document.all.page1.Height=document.body.scrollHeight">
    <table>
    <tr>
    <td>这是页面1测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测
    </td>
    </tr>
    </table>
    </body>
    </HTML>
    2.htm
    ==============================================================================
    <HTML>
    <body topmargin=0 onload="parent.document.all.page2.Height=self.document.body.scrollHeight">
    <table>
    <tr>
    <td>这是页面2测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试
    </td>
    </tr>
    </table>
    </HTML>
      

  5.   

    net_lover(孟子E章),你真是厉害,这里的所有问题好像都是你解决的,你说的方法可以实现,但是我在上面提到的1.htm和2.htm分别有好几百个页面,而且已经做好了,如果现在往里面加程序,我看我得累死,请你想个办法,与1.htm和2.htm无关的方法。谢谢了,我已经很感激了