<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="denglu" %><!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>
    <script type="text/javascript"> 
function show(){ 
var screenWidth = document.documentElement.clientWidth+document.documentElement.scrollLeft; 
var screenHeight = document.documentElement.clientHeight; 
alert('screenWidth::'+screenWidth+'   screenHeight::'+screenHeight);
var divObj = document.getElementById("mydiv"); 
var divWidth = divObj.offsetWidth; 
var divHeight = divObj.offsetHeight; 
var left = parseInt((screenWidth - divWidth)/2); 
var top = parseInt((screenHeight - divHeight)/2); 
divObj.style.left = left+document.documentElement.scrollLeft;
divObj.style.top = top+document.documentElement.scrollTop;

</script> 
    <style type="text/css">
        #Button1
        {
            width: 55px;
        }
        #Button2
        {
            width: 57px;
        }
    </style>
</head>
<body style= "text-align:center ">
    <form id="form1" runat="server">
    <div style="width: 100%; height: 700px; background-color: #C0C0C0">
    
        <br />
        <br />
        
        <div style="background-image: url('background images/20101001.jpg'); height: 515px; width: 720px; margin-left: auto;
margin-right: auto;">
            
            <div style="position: absolute; top: 293px; left: 556px; width: 333px; height: 219px;">
            
                <div style="position: absolute; top: 11px; left: 5px; width: 318px; height: 27px; bottom: 181px;">
                    <asp:Label ID="Label2" runat="server" Text="类 &nbsp; &nbsp;别:" Font-Size="Larger"></asp:Label>
                    <asp:DropDownList ID="DropDownList1" runat="server" Font-Size="Small" 
                        Height="24px" Width="126px">
                        <asp:ListItem>管理员</asp:ListItem>
                        <asp:ListItem>教师</asp:ListItem>
                        <asp:ListItem>学生</asp:ListItem>
                    </asp:DropDownList>
                </div>
                <div style="position: absolute; top: 54px; left: 4px; width: 318px; height: 27px;">
                    <asp:Label ID="Label3" runat="server" Text="用户名:" Font-Size="Larger"></asp:Label>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </div>
                <div style="position: absolute; top: 96px; left: 5px; width: 318px; height: 27px;">
                    <asp:Label ID="Label4" runat="server" Text="密     &nbsp;     码:" Font-Size="Larger"></asp:Label>
                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                </div>
                <div style="position: absolute; top: 140px; left: 4px; width: 317px; height: 27px;">
                    <asp:Label ID="Label5" runat="server" Text="验证码:" Font-Size="Larger"></asp:Label>
                    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                    
                </div>                <div style="position: absolute; top: 179px; left: 7px; width: 314px; height: 36px; text-align:center">
                    <asp:Button ID="Button1" runat="server" Text="登陆" Font-Size="Larger" 
                        onclick="Button1_Click" /> 
                    &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp; 
                    <asp:Button ID="Button2" runat="server" Text="退出" Font-Size="Larger" 
                        onclick="Button2_Click" />
                    </div>
            </div>
            
        </div>
        
    </div>
    </form>
</body>
</html>
请大家帮我看看这下面段为什么会以为,有什么解决方法吗?<div style="position: absolute; top: 293px; left: 556px; width: 333px; height: 219px;">
            
                <div style="position: absolute; top: 11px; left: 5px; width: 318px; height: 27px; bottom: 181px;">
                    <asp:Label ID="Label2" runat="server" Text="类 &nbsp; &nbsp;别:" Font-Size="Larger"></asp:Label>
                    <asp:DropDownList ID="DropDownList1" runat="server" Font-Size="Small" 
                        Height="24px" Width="126px">
                        <asp:ListItem>管理员</asp:ListItem>
                        <asp:ListItem>教师</asp:ListItem>
                        <asp:ListItem>学生</asp:ListItem>
                    </asp:DropDownList>
                </div>
                <div style="position: absolute; top: 54px; left: 4px; width: 318px; height: 27px;">
                    <asp:Label ID="Label3" runat="server" Text="用户名:" Font-Size="Larger"></asp:Label>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </div>
                <div style="position: absolute; top: 96px; left: 5px; width: 318px; height: 27px;">
                    <asp:Label ID="Label4" runat="server" Text="密     &nbsp;     码:" Font-Size="Larger"></asp:Label>
                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                </div>
                <div style="position: absolute; top: 140px; left: 4px; width: 317px; height: 27px;">
                    <asp:Label ID="Label5" runat="server" Text="验证码:" Font-Size="Larger"></asp:Label>
                    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                    
                </div>                <div style="position: absolute; top: 179px; left: 7px; width: 314px; height: 36px; text-align:center">
                    <asp:Button ID="Button1" runat="server" Text="登陆" Font-Size="Larger" 
                        onclick="Button1_Click" /> 
                    &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp; 
                    <asp:Button ID="Button2" runat="server" Text="退出" Font-Size="Larger" 
                        onclick="Button2_Click" />
                    </div>
            </div>

解决方案 »

  1.   

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
      <title>欢迎登陆---学生成绩管理系统</title>
      <script type="text/javascript">
          function show() {
              var screenWidth = document.documentElement.clientWidth + document.documentElement.scrollLeft;
              var screenHeight = document.documentElement.clientHeight;
              alert('screenWidth::' + screenWidth + ' screenHeight::' + screenHeight);
              var divObj = document.getElementById("mydiv");
              var divWidth = divObj.offsetWidth;
              var divHeight = divObj.offsetHeight;
              var left = parseInt((screenWidth - divWidth) / 2);
              var top = parseInt((screenHeight - divHeight) / 2);
              divObj.style.left = left + document.documentElement.scrollLeft;
              divObj.style.top = top + document.documentElement.scrollTop;
          } 
    </script> 
      <style type="text/css">
      #Button1
      {
      width: 55px;
      }
      #Button2
      {
      width: 57px;
      }
      </style>
    </head>
    <body style= "text-align:center ">
      <form id="form1" runat="server">
      <div style="width: 100%; height: 700px; background-color: #C0C0C0">
       
      <br />
      <br />
       
      <div style="background-image: url('background images/20101001.jpg'); height: 515px; width: 720px; margin-left: auto;
    margin-right: auto;">
       
      <div style="position: absolute; top: 293px; left: 556px; width: 333px; height: 219px;">
       
      <div style="position: absolute; top: 11px; left: 5px; width: 318px; height: 27px; bottom: 181px;">
      <asp:Label ID="Label2" runat="server" Text="类" Font-Size="Larger"></asp:Label>
      <asp:Label ID="Label6" runat="server" Text="别:" style=" margin-left:9px;" Font-Size="Larger"></asp:Label>
      <asp:DropDownList ID="DropDownList1" runat="server" Font-Size="Small" 
      Height="24px" Width="154px">
      <asp:ListItem>管理员</asp:ListItem>
      <asp:ListItem>教师</asp:ListItem>
      <asp:ListItem>学生</asp:ListItem>
      </asp:DropDownList>
      </div>
      <div style="position: absolute; top: 54px; left: 4px; width: 318px; height: 27px;">
      <asp:Label ID="Label3" runat="server" Text="用户名:" Font-Size="Larger"></asp:Label>
      <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
      </div>
      <div style="position: absolute; top: 96px; left: 5px; width: 318px; height: 27px;">
      <asp:Label ID="Label4" runat="server" Text="密" Font-Size="Larger"></asp:Label>
      <asp:Label ID="Label1" runat="server" Text="码:" style=" margin-left:9px;" Font-Size="Larger"></asp:Label>
      <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
      </div>
      <div style="position: absolute; top: 140px; left: 4px; width: 317px; height: 27px;">
      <asp:Label ID="Label5" runat="server" Text="验证码:" Font-Size="Larger"></asp:Label>
      <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
       
      </div>  <div style="position: absolute; top: 179px; left: 7px; width: 314px; height: 36px; text-align:center">
      <asp:Button ID="Button1" runat="server" Text="登陆" Font-Size="Larger" /> 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      <asp:Button ID="Button2" runat="server" Text="退出" Font-Size="Larger" />
      </div>
      </div>
       
      </div>
       
      </div>
      </form>
    </body>
    </html>
      

  2.   

    你本身的布局就不行啊!!一般都用div+css!!!