下面的那个空白的地方也是个Div只不过在页面加载的时候隐藏啦!但是为什么还有空白了当我点击企业会员登录的时候
上面的那个隐藏
现在的问题是上面的那个是空白啦
企业会员在下面出现

解决方案 »

  1.   

    2个Div是这样写得
    个人会员的
     <tr>
       <td valign="top" height="135px;">
       <div id="GR" style="width: 200px;border: 1px solid #CCC;background-color: #f7f7f7; z-index:0px;">
    ....
         </div>
        </td>
     </tr>
    企业会员的
     <tr>
       <td valign="top" height="135px;">
       <div id="Qy" style="width: 200px;border: 1px solid #CCC;background-color: #f7f7f7; z-index:0px;">
    ....
         </div>
        </td>
     </tr>
      

  2.   

    样式中的两个属性也许楼主该看看
    dispaly
    visibility
      

  3.   

    个人会员  
     <div id="GR" style="width: 200px;border: 1px solid #CCC;background-color: #f7f7f7;" >
       <table width="240" border="0" cellspacing="0" cellpadding="0">
       <tr>
        <td><img src="images/index_09_01.jpg" width="125" height="45" border=0 /><img src="images/index_09_02.jpg" width="131" height="45" border=0 onclick="document.getElementById('GR').display='none';document.getElementById('QY').display='block';" /></td>
       </tr>
    </div>
    企业会员
     <div id="QY" style="width: 200px; border: 1px solid #CCC; background-color: #f7f7f7; display:none;">
       <table width="240" border="0" cellspacing="0" cellpadding="0" >
       <tr>
        <td><img src="images/222222.jpg" width="125" height="45" border=0 onclick="document.getElementById('QY').display='none';document.getElementById('GR').display='block';" /><img src="images/111111.jpg" width="131" height="45" border=0 /></td>
       </tr>
    </div>
      

  4.   

    <td valign="top" height="135px;">height不要设, 让他自动调整
      

  5.   

    div的style中加上display:inline试下
      

  6.   

    10楼的兄弟帮忙看下
    这个是的JS 代码<script type="text/javascript">
    function ShowQy()
    {//visibility:visible
      var oTb=document.getElementById('GR');
      var oqy=document.getElementById('QY');
      oTb.style.display="none";
      oqy.style.display="block";
    }
    function ShowGr()
    {
      var oTb=document.getElementById('GR');
      var oqy=document.getElementById('QY');
      oTb.style.display="block";
      oqy.style.display="none";
    }
    //页面加载的时候
    function ShowLogin()
    {
      var oTb=document.getElementById('GR');
      var oqy=document.getElementById('QY');
      oTb.style.display="block";
      oqy.style.display="none";
    }
    </script>个人会员
     <div id="GR" style="width: 200px;border: 1px solid #CCC;background-color: #f7f7f7;" >
       <table width="240" border="0" cellspacing="0" cellpadding="0">
       <tr>
        <td><img src="images/index_09_01.jpg" width="125" height="45" border=0 /><img src="images/index_09_02.jpg" width="131" height="45" border=0 onclick="ShowQy();" /></td>
       </tr>
    </div>企业会员
    <div id="QY" style="width: 200px; border: 1px solid #CCC; background-color: #f7f7f7;">
       <table width="240" border="0" cellspacing="0" cellpadding="0" >
       <tr>
        <td><img src="images/222222.jpg" width="125" height="45" border=0 onclick="ShowGr();" /><img src="images/111111.jpg" width="131" height="45" border=0 /></td>
       </tr>
    </div>
      

  7.   


    <div id="GR" style="width: 200px;border: 1px solid #CCC;background-color: #f7f7f7;" >
       <table width="240" border="0" cellspacing="0" cellpadding="0">
       <tr>
        <td><img src="images/index_09_01.jpg" width="125" height="45" border=0 /><img src="images/index_09_02.jpg" width="131" height="45" border=0 onclick="ShowQy();" /></td>
       </tr>
    </div>
    少了个</table>
      

  8.   

    是的   <div id="GR" style="width: 200px;border: 1px solid #CCC;background-color: #f7f7f7; display:inline;" >
     <div id="QY" style="width: 200px; border: 1px solid #CCC; background-color: #f7f7f7; display:inline;">
      

  9.   

    js代码中block也改成inline,再试试
    <script type="text/javascript">
    function ShowQy()
    {//visibility:visible
      var oTb=document.getElementById('GR');
      var oqy=document.getElementById('QY');
      oTb.style.display="none";
      oqy.style.display="block";
    }
    function ShowGr()
    {
      var oTb=document.getElementById('GR');
      var oqy=document.getElementById('QY');
      oTb.style.display="block";
      oqy.style.display="none";
    }
    //页面加载的时候
    function ShowLogin()
    {
      var oTb=document.getElementById('GR');
      var oqy=document.getElementById('QY');
      oTb.style.display="block";
      oqy.style.display="none";
    }
    </script>
      

  10.   

    你看看你的table有没有关闭,贴出来的代码上显示没关闭
      

  11.   

    td中的height加高度了,去掉试试。
      

  12.   

    table标签没有闭合吧
    <div id="GR" style="width: 200px;border: 1px solid #CCC;background-color: #f7f7f7;" >
       <table width="240" border="0" cellspacing="0" cellpadding="0">
       <tr>
        <td><img src="images/index_09_01.jpg" width="125" height="45" border=0 /><img src="images/index_09_02.jpg" width="131" height="45" border=0 onclick="ShowQy();" /></td>
       </tr>
       </table>
    </div>
    <div id="QY" style="width: 200px; border: 1px solid #CCC; background-color: #f7f7f7;">
       <table width="240" border="0" cellspacing="0" cellpadding="0" >
       <tr>
        <td><img src="images/222222.jpg" width="125" height="45" border=0 onclick="ShowGr();" /><img src="images/111111.jpg" width="131" height="45" border=0 /></td>
       </tr>
       </table>
    </div>
      

  13.   


    下面是
    个人会员的Div
    <div id="GR" style="width: 200px;border: 1px solid #CCC;background-color: #f7f7f7; display:inline;" >
       <table width="240" border="0" cellspacing="0" cellpadding="0">
       <tr>
        <td><img src="images/index_09_01.jpg" width="125" height="45" border=0 /><img src="images/index_09_02.jpg" width="131" height="45" border=0 onclick="ShowQy();" /></td>
       </tr>
      <tr>
        <td height="99" background="images/index_12.gif"><table width="230" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><table width="220" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="172"><table width="170" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="50" height="28">用户名</td>
                  
                      <td height="28">
                          <asp:TextBox ID="BJUserInfo_Title" MaxLength="12" runat="server" Width="118px"></asp:TextBox>
                       
                   </td>
                   
                  </tr>
                  <tr>
                    <td width="50" height="28">密&nbsp; 码</td>
                  
                      <td height="28">
                          <asp:TextBox ID="BJUserInfo_PassWord" TextMode="Password" MaxLength="16" runat="server" Width="117px"></asp:TextBox>
               
                      </td>
                  
                  </tr>
                </table></td>
                <td width="48">
                    <asp:ImageButton ID="ImageButton1" ImageUrl="images/login.jpg" runat="server" width="48" height="48" Border=0 OnClick="ImageButton1_Click" />
               
                
                </td>
              </tr>
            </table></td>
          </tr>
          <tr align="center">
            <td>
                <asp:ImageButton ID="ImageButton2" ImageUrl="images/zc.jpg" width="92" height="25"  runat="server" border=0 OnClick="ImageButton2_Click" />
            
            &nbsp;&nbsp;
                <asp:ImageButton ID="ImageButton3" ImageUrl="images/mm.GIF" runat="server" width="81" height="25" OnClick="ImageButton3_Click" />        
            </td>
          </tr>
        </table></td>
      </tr>
      
       </table>
       </div>
      

  14.   

    企业会员的<div id="QY" style="width: 200px; border: 1px solid #CCC; background-color: #f7f7f7; display:inline;">
       <table width="240" border="0" cellspacing="0" cellpadding="0" >
       <tr>
        <td><img src="images/222222.jpg" width="125" height="45" border=0 onclick="ShowGr();" /><img src="images/111111.jpg" width="131" height="45" border=0 /></td>
       </tr>
      <tr>
        <td height="99" background="images/index_12.gif"><table width="230" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><table width="220" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="172"><table width="170" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="50" height="28">用户名</td>
                  
                      <td height="28">
                           <asp:TextBox ID="BJEnterPrize_EnterPrizeName" runat="server" MaxLength="12" Width="118px"></asp:TextBox>
                       
                   </td>
                   
                  </tr>
                  <tr>
                    <td width="50" height="28">密&nbsp; 码</td>
                  
                      <td height="28">
                       <asp:TextBox ID="BJEnterPrize_Password" runat="server" MaxLength="16"  Width="117px" TextMode="Password"></asp:TextBox>
               
                      </td>
                  
                  </tr>
                </table></td>
                <td width="48">
                    <asp:ImageButton ID="ImgQy" ImageUrl="images/login.jpg" runat="server" width="48" height="48" Border=0 OnClick="ImgQy_Click"  />
               
                
                </td>
              </tr>
            </table></td>
          </tr>
          <tr align="center">
            <td>
                <asp:ImageButton ID="Qyzc" ImageUrl="images/zc.jpg" width="92" height="25"  runat="server" border=0 OnClick="Qyzc_Click" />
            
            &nbsp;&nbsp;
                <asp:ImageButton ID="QyPwd" ImageUrl="images/mm.GIF" runat="server" width="81" height="25" OnClick="QyPwd_Click" />        
            </td>
          </tr>
        </table></td>
      </tr>
      
       </table>
       </div>顺便问下还有其它的方法吗
      

  15.   

    把所有.display='block'
    --------->
    .display=''试一下
      

  16.   

    经过测试,我这边在IE和FF下都能正常显示
    不清楚是由于什么原因不过可以换个思路,可以利用table的tr显示、隐藏
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>1</title>
    <script type="text/javascript">
    function ShowTr(num)
    {
    if(num==1){
    document.getElementById("tr1").style.display="block";
    document.getElementById("tr2").style.display="none";
    document.getElementById("img1").src = "images/index_09_01.jpg";
    document.getElementById("img2").src = "images/index_09_02.jpg";
    }else{
    document.getElementById("tr2").style.display="block";
    document.getElementById("tr1").style.display="none";
    document.getElementById("img1").src = "images/222222.jpg";
    document.getElementById("img2").src = "images/111111.jpg";
    }
    }
    </script>
    </head>
    <body>
       <table width="200px" border="0" cellspacing="0" cellpadding="0">
       <tr>
        <td>
        <img id="img1" src="images/index_09_01.jpg" width="120" height="45" border=0 onclick="ShowTr(1);"/><img id="img2" src="images/index_09_02.jpg" width="120" height="45" border=0 onclick="ShowTr(2);" />
        </td>
       </tr>
       <tr id=tr1>
       <td>11111</td>
       </tr>
       <tr id=tr2 style="display:none">
       <td>22222</td>
       </tr>
       </table>
    </body>
    </html>
      

  17.   

    楼主好好检查吧,要应藏和显示的DIV最好别放再有固定宽高的容器里面。要么可以采取另外的做法;
    <% if(登陆成功的条件){ %>
        html代码
    <% }else {%>
        html代码
    <% } %>
    通过这样的方法规避,显示和隐藏的问题,而是通过条件去执行还是不执行html代码来实现。