<head runat="server"> 
    <title>无标题页 </title> 
    <script language="javascript" type="text/javascript"> 
    function divtest() 
    { 
    
    } 
    </script> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div id="divTry" style="background-color:Blue"> </div> 
<input id="Button1" type="button" value="button" onclick="divtest()" />
    </form> 
</body> 
</html> 我想在FF和IE中都实现: 
点击按钮.div全屏,大部分代码已给.希望大家帮忙补充完整. 注:兼容IE.FF(IE的早已实现.) 
运行通过.马上结贴!! 
希望大家测试过在发.

解决方案 »

  1.   

    <head runat="server">
        <title>无标题页 </title>
        <script language="javascript" type="text/javascript">
        function divtest()
        {
    w = window.screen.width;
    h = window.screen.height;
            document.getElementById("divTry").style.width=w
    document.getElementById("divTry").style.height=h
    document.body.style.margin="0";
    document.body.style.padding="0"
        }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div id="divTry" style="background-color:Blue"> </div>
    <input id="Button1" type="button" value="button" onclick="divtest()" />
        </form>
    </body>
    </html> 
      

  2.   

    <head runat="server"> 
        <title>test</title> 
        <script language="javascript" type="text/javascript"> 
        function divtest() 
        { alert((document.body.clientHeight||window.innerHeight)+"px");
        document.getElementById("divTry").style.width=(document.body.clientWidth||window.innerWidth)+"px";
        document.getElementById("divTry").style.height=(document.body.clientHeight||window.innerHeight)+"px";
        } 
        </script> 
    </head> 
    <body> 
        <form id="form1" runat="server"> 
        <div id="divTry" style="background-color:#Blue"> </div> 
    <input id="Button1" type="button" value="button" onclick="divtest()" /> 
        </form> 
    </body> 
    </html>
      

  3.   


    <html>
    <head runat="server">
        <title>无标题页 </title>
        <script language="javascript" type="text/javascript">
        function divtest() 
        {
    oldNode=document.getElementById("Button1");
    divNode=document.getElementById("divTry");
    divNode.appendChild(oldNode);
    document.getElementsByTagName("body")[0].style.margin=0;
        divNode.style.width=(document.body.clientWidth||window.innerWidth)+"px";
        divNode.style.height=(document.body.clientHeight||window.innerHeight)+"px";
        }     </script>
    </head>
    <body>
        <form id="form1" runat="server">
    <div id="divTry" style="background-color:Blue"> </div>
    <input id="Button1" type="button" value="button" onclick="divtest()" />
        </form>
    </body>
    </html>
      

  4.   

    楼上几段代码我在FF下测试比全屏大了点(会出现滚动条
    <head runat="server">
    <title>无标题页 </title>
    <script language="javascript" type="text/javascript">
    function divtest(obj)
    {
    w = document.body.clientWidth;
    h = document.body.clientHeight;
    document.getElementById("divTry").style.width=w;
    document.getElementById("divTry").style.height=h+"px";
    document.body.style.margin="0px";
    document.body.style.padding="0px"
    document.body.style.marginBottom="-100px";
    obj.style.display="none";
    }
    </script>
    </head>
    <body>
    <form id="form1" runat="server">
    <div id="divTry" style="background-color:Blue"></div>
    <input id="Button1" type="button" value="button" onclick="divtest(this)" />
    </form>
    </body>
    </html> 
    这样就不会了,ie6 ff3.5.7测试通过