将表格显示为弹出窗口/在HTML顶部

Displaying table as pop up/ on the top of HTML

本文关键字:HTML 顶部 窗口 表格 显示      更新时间:2023-09-26

我的数据列表中有一个链接

<a href="#" onclick="showHideDesc(this); return false;"  class="prod_details">details</a>
             <table style="display: none; background-color:AntiqueWhite; border-color:Black;
                     direction:rtl;" class="MyTable">
                  <tr>    
                     <td>
                       <asp:Label ID="lblShowHide" runat="server" 
                        Text='<%#DataBinder.Eval(Container.DataItem,"Description")%>'></asp:Label>
                     </td> 
                  </tr>   
             </table>  

点击链接后,我将通过以下功能显示与链接相关的关联表:

    <script type="text/javascript" language="javascript">
  function showHideDesc(link)
   {
     var table = link.parentNode.getElementsByTagName("TABLE")[0];
       if (table.style.display == "none")
         {
           table.style.display = "";
           link.innerHTML = "details";
         }     
       else 
         {         
           table.style.display = "none";         
           link.innerHTML = "details";     
         } 
   }
 </script>

到目前为止,它运行良好,但问题出现了,我显示的描述是10-15行,并且由于数据列表中的其他记录,该表被隐藏。我需要在每个HTML的顶部显示这个。。一些弹出式的东西。

请帮助

要在其他HTML内容之上显示您的表,您应该使用z-indexCSS属性。这样可以对您的内容进行某种分层。看看http://w3schools.com/css/css_positioning.asp有关更多信息,