透過CSS設定,達到類似Excel凍結視窗的效果(固定上面、左邊表頭)

來源:互聯網
上載者:User

直接看asp範例

 

<%@ Language=VBScript %><%xcnt = 50ycnt = 60%><HTML><HEAD><META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"><style type="text/css">      .FixedTitleRow        {            position: relative;             top: expression(this.offsetParent.scrollTop-2);             z-index: 10;            background-color: #E6ECF0;        }                .FixedTitleColumn        {            position: relative;             left: expression(this.parentElement.offsetParent.scrollLeft-2);        }                .FixedDataColumn        {            position: relative;            left: expression(this.parentElement.offsetParent.parentElement.scrollLeft-2);            background-color: #E6ECF0;        }</style></HEAD><BODY><div style="width:800px;height:560px;overflow:scroll;"><Table border=1><tr class="FixedTitleRow"><th class="FixedTitleColumn">xxxx1</th><th class="FixedTitleColumn">xxxx2</th><th class="FixedTitleColumn">xxxx3</th><%For x = 4 to xcnt%><th class="">th<%=x%></th><%Next%></tr><%For y = 1 to ycnt%><tr><td class="FixedDataColumn">xxxxyyyy</td><td class="FixedDataColumn">xxxxyyyy</td><td class="FixedDataColumn">xxxxyyyy</td><%For x = 4 to xcnt%><td>td<%=x%>,<%=y%></td><%Next%></tr><%Next%></table></div></BODY></HTML>

相同的方式,應該也可以用在GridView裡面

參考網址:http://www.chenjiliang.com/Article/View.aspx?ArticleID=1876&TypeID=30

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.