小弟想让页面上的三个div层根据浏览器窗口大小自动调整大小,代码如下,在html中完全正常,一放到aspx文件中就不能执行,浏览器打开后就停止响应,请问各位大侠问题出在哪儿,多谢多谢!!!各位大哥帮帮忙,分不够可以再加!!!谢了!!!!!!
       <script>
    function scall()
    {
        document.getElementById("TopDiv1").style.width=document.body.clientWidth-150;
        document.getElementById("LeftDiv1").style.height=document.body.clientHeight;
        document.getElementById("ConDiv1").style.height=document.body.clientHeight-80;
        document.getElementById("ConDiv1").style.width=document.body.clientWidth-150;
    }
   window.onscroll=scall;
    window.onresize=scall;
    window.onload=scall;
    </script>===============================================================
完整的全部代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="p3-nomang.aspx.cs" Inherits="p3_nomang" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
       <style type="text/css">
    .div
    {
     position: absolute;
     border: 1px solid #9999ff;
     background-color: #ffffcc;
     font-size:12px;
     z-index:1000;
    }
    </style>
        <script>
    function scall()
    {
        document.getElementById("TopDiv1").style.width=document.body.clientWidth;
        document.getElementById("LeftDiv1").style.height=document.body.clientHeight;
        document.getElementById("ConDiv1").style.height=document.body.clientHeight-12;
        document.getElementById("ConDiv1").style.width=document.body.clientWidth-8;
    }
   window.onscroll=scall;
    window.onresize=scall;
    window.onload=scall;
    </script>
</head>
<body>
    <form id="form1" runat="server">
     <div id="LeftDiv1" class="div" style="z-index: 101; left: 0px; width: 150px; top: 0px;
                height: 100%; ">
     </div>
     <div id="TopDiv1" class="div" style="z-index: 1; left: 141px;top: -15px;
          height: 80px; overflow: hidden; position: relative; text-align: right;">
         <asp:Button ID="Button1" runat="server" Text="Button" />
     </div>
     <div id="ConDiv1" class="div" style="z-index: 101; left: 142px; width: 85%; position: relative; top: -13px;
                    height: 500px; background-color: #ccffcc; border-right: #99ccff thin inset; border-top: #99ccff thin inset; overflow: scroll; border-left: #99ccff thin inset; border-bottom: #99ccff thin inset;">
     </div>
    </form>
</body>
</html>