在ASP中,如何使表格的表头不跟着内容循环
我只想要一行表头,下面的内容循环显示,可是一循环,表头也跟着循环,怎么样才能解决这个问题,应该是把表头移除循环体,可是我不会做,哪位高手帮帮忙啊!谢谢!...
我只想要一行表头,下面的内容循环显示,可是一循环,表头也跟着循环,怎么样才能解决这个问题,应该是把表头移除循环体,可是我不会做,哪位高手帮帮忙啊!谢谢!
展开
2个回答
展开全部
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>固定表头和列</title>
<style>
.FixedTitleRow
{
position: relative;
top: expression(this.offsetParent.scrollTop);
z-index: 10;
background-color: #E6ECF0;
}
.FixedTitleColumn
{
position: relative;
left: expression(this.parentElement.offsetParent.scrollLeft);
}
.FixedDataColumn
{
position: relative;
left: expression(this.parentElement.offsetParent.parentElement.scrollLeft);
background-color: #E6ECF0;
}
</style>
</head><body>
<div id="scrollDiv" style="width: 300px; overflow: auto; cursor: default; display: inline;
position: absolute; height: 200px;">
<table id='accountTable' width='500' height='230' cellpadding='0' cellspacing='0'
style='table-layout: auto' bordercolor='lightgrey'>
<tbody>
<tr class="FixedTitleRow">
<td class="FixedTitleColumn">ID0</td>
<td class="FixedTitleColumn">CK0</td>
<td class="FixedTitleColumn">Code0</td>
<td class="FixedTitleColumn">Descirption0</td>
<td class="FixedTitleColumn">TOL0</td>
<td>XS0</td>
<td>SS0</td>
<td>MS0</td>
<td>DS0</td>
<td>BS0</td>
<td>XL0</td>
<td>ML0</td>
<td>DL0</td>
<td>EM0</td>
<td>BM0</td>
</tr><tr>
<td class="FixedDataColumn">88</td>
<td class="FixedDataColumn">88</td>
<td class="FixedDataColumn">88</td>
<td class="FixedDataColumn">88</td>
<td class="FixedDataColumn">88</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
</tr><tr>
<td class="FixedDataColumn">111</td>
<td class="FixedDataColumn">111</td>
<td class="FixedDataColumn">1111</td>
<td class="FixedDataColumn">This is Test</td>
<td class="FixedDataColumn">1</td>
<td>001</td>
<td>002</td>
<td>003</td>
<td>004</td>
<td>005</td>
<td>006</td>
<td>007</td>
<td>008</td>
<td>009</td>
<td>010</td>
</tr><tr>
<td class="FixedDataColumn">111</td>
<td class="FixedDataColumn">111</td>
<td class="FixedDataColumn">1111</td>
<td class="FixedDataColumn">This is Test</td>
<td class="FixedDataColumn">1</td>
<td>001</td>
<td>002</td>
<td>003</td>
<td>004</td>
<td>005</td>
<td>006</td>
<td>007</td>
<td>008</td>
<td>009</td>
<td>010</td>
</tr><tr>
<td class="FixedDataColumn">111</td>
<td class="FixedDataColumn">111</td>
<td class="FixedDataColumn">1111</td>
<td class="FixedDataColumn">This is Test</td>
<td class="FixedDataColumn">1</td>
<td>001</td>
<td>002</td>
<td>003</td>
<td>004</td>
<td>005</td>
<td>006</td>
<td>007</td>
<td>008</td>
<td>009</td>
<td>010</td>
</tr>
</tbody>
</table>
</div>
</body></html>
这是个例子,你做一个这样的样式,套用到你那里就可以了
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>固定表头和列</title>
<style>
.FixedTitleRow
{
position: relative;
top: expression(this.offsetParent.scrollTop);
z-index: 10;
background-color: #E6ECF0;
}
.FixedTitleColumn
{
position: relative;
left: expression(this.parentElement.offsetParent.scrollLeft);
}
.FixedDataColumn
{
position: relative;
left: expression(this.parentElement.offsetParent.parentElement.scrollLeft);
background-color: #E6ECF0;
}
</style>
</head><body>
<div id="scrollDiv" style="width: 300px; overflow: auto; cursor: default; display: inline;
position: absolute; height: 200px;">
<table id='accountTable' width='500' height='230' cellpadding='0' cellspacing='0'
style='table-layout: auto' bordercolor='lightgrey'>
<tbody>
<tr class="FixedTitleRow">
<td class="FixedTitleColumn">ID0</td>
<td class="FixedTitleColumn">CK0</td>
<td class="FixedTitleColumn">Code0</td>
<td class="FixedTitleColumn">Descirption0</td>
<td class="FixedTitleColumn">TOL0</td>
<td>XS0</td>
<td>SS0</td>
<td>MS0</td>
<td>DS0</td>
<td>BS0</td>
<td>XL0</td>
<td>ML0</td>
<td>DL0</td>
<td>EM0</td>
<td>BM0</td>
</tr><tr>
<td class="FixedDataColumn">88</td>
<td class="FixedDataColumn">88</td>
<td class="FixedDataColumn">88</td>
<td class="FixedDataColumn">88</td>
<td class="FixedDataColumn">88</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
<td>22</td>
</tr><tr>
<td class="FixedDataColumn">111</td>
<td class="FixedDataColumn">111</td>
<td class="FixedDataColumn">1111</td>
<td class="FixedDataColumn">This is Test</td>
<td class="FixedDataColumn">1</td>
<td>001</td>
<td>002</td>
<td>003</td>
<td>004</td>
<td>005</td>
<td>006</td>
<td>007</td>
<td>008</td>
<td>009</td>
<td>010</td>
</tr><tr>
<td class="FixedDataColumn">111</td>
<td class="FixedDataColumn">111</td>
<td class="FixedDataColumn">1111</td>
<td class="FixedDataColumn">This is Test</td>
<td class="FixedDataColumn">1</td>
<td>001</td>
<td>002</td>
<td>003</td>
<td>004</td>
<td>005</td>
<td>006</td>
<td>007</td>
<td>008</td>
<td>009</td>
<td>010</td>
</tr><tr>
<td class="FixedDataColumn">111</td>
<td class="FixedDataColumn">111</td>
<td class="FixedDataColumn">1111</td>
<td class="FixedDataColumn">This is Test</td>
<td class="FixedDataColumn">1</td>
<td>001</td>
<td>002</td>
<td>003</td>
<td>004</td>
<td>005</td>
<td>006</td>
<td>007</td>
<td>008</td>
<td>009</td>
<td>010</td>
</tr>
</tbody>
</table>
</div>
</body></html>
这是个例子,你做一个这样的样式,套用到你那里就可以了
展开全部
你说的对!应在应在循环外,见我的asp【部分代码:】
...
<table width="100%" border="0" cellpadding="0" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FF0000">
<caption><font size="3" color="#660099">我的开放式基金一览表</font></caption>
<tr bgcolor="#FFFFFF">
<td width="5%" align="center"><span class="STYLE1 STYLE1">基金代码</span></td>
<td width="9%" align="center"><span class="STYLE1 STYLE1">基金名称</span></td>
<td width="4%" align="center"><span class="STYLE1 STYLE1">日净值</span></td>
<td width="5%" align="center"><span class="STYLE1 STYLE1">日期</span></td>
<td width="5%" align="center"><span class="STYLE1 STYLE1 STYLE1">投资总额</span></td>
<td width="5%" align="center"><span class="STYLE1 STYLE1 STYLE1">基金分额</span></td>
<td width="5%" align="center"><span class="STYLE1 STYLE1 STYLE1">目前市值</span></td>
<td width="4%" align="center"><span class="STYLE1 STYLE1 STYLE1">增减金额</span></td>
<td width="2%" align="center"><span class="STYLE1">月数</span></td>
<td width="3%" align="center"><span class="STYLE1 STYLE1 STYLE1">基金成本</span></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Rs2.EOF))
%>
<tr>
<td bgcolor="#FFFFFF"><%=(Rs2.Fields.Item("代码").Value)%></td>
<td bgcolor="#FFFFFF"><%=(Rs2.Fields.Item("名称").Value)%></td>
<td align="right" bgcolor="#FFFFFF"><%=Formatnumber((Rs2.Fields.Item("日净值").Value),4,-1)%></td>
<td align="center" bgcolor="#FFFFFF"><%=(Rs2.Fields.Item("入日期").Value)%></td>
<td align="right" bgcolor="#FFFFFF"><%=Formatnumber((Rs2.Fields.Item("投资额").Value),2)%></td>
<td align="right" bgcolor="#FFFFFF"><%=Formatnumber((Rs2.Fields.Item("份额").Value),2)%></td>
<td align="right" bgcolor="#FFFFFF"><%=Formatnumber((Rs2.Fields.Item("市值").Value),2)%></td>
<td align="right" bgcolor="#FFFFFF"><%=Formatnumber((Rs2.Fields.Item("增减").Value),2,-1)%></td>
<td align="center" bgcolor="#FFFFFF"><%=(Rs2.Fields.Item("天数").Value)%></td>
<td align="right" bgcolor="#FFFFFF"><%=Formatnumber((Rs2.Fields.Item("成本").Value),4,-1)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Rs2.MoveNext()
Wend
%>
...
...
<table width="100%" border="0" cellpadding="0" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FF0000">
<caption><font size="3" color="#660099">我的开放式基金一览表</font></caption>
<tr bgcolor="#FFFFFF">
<td width="5%" align="center"><span class="STYLE1 STYLE1">基金代码</span></td>
<td width="9%" align="center"><span class="STYLE1 STYLE1">基金名称</span></td>
<td width="4%" align="center"><span class="STYLE1 STYLE1">日净值</span></td>
<td width="5%" align="center"><span class="STYLE1 STYLE1">日期</span></td>
<td width="5%" align="center"><span class="STYLE1 STYLE1 STYLE1">投资总额</span></td>
<td width="5%" align="center"><span class="STYLE1 STYLE1 STYLE1">基金分额</span></td>
<td width="5%" align="center"><span class="STYLE1 STYLE1 STYLE1">目前市值</span></td>
<td width="4%" align="center"><span class="STYLE1 STYLE1 STYLE1">增减金额</span></td>
<td width="2%" align="center"><span class="STYLE1">月数</span></td>
<td width="3%" align="center"><span class="STYLE1 STYLE1 STYLE1">基金成本</span></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Rs2.EOF))
%>
<tr>
<td bgcolor="#FFFFFF"><%=(Rs2.Fields.Item("代码").Value)%></td>
<td bgcolor="#FFFFFF"><%=(Rs2.Fields.Item("名称").Value)%></td>
<td align="right" bgcolor="#FFFFFF"><%=Formatnumber((Rs2.Fields.Item("日净值").Value),4,-1)%></td>
<td align="center" bgcolor="#FFFFFF"><%=(Rs2.Fields.Item("入日期").Value)%></td>
<td align="right" bgcolor="#FFFFFF"><%=Formatnumber((Rs2.Fields.Item("投资额").Value),2)%></td>
<td align="right" bgcolor="#FFFFFF"><%=Formatnumber((Rs2.Fields.Item("份额").Value),2)%></td>
<td align="right" bgcolor="#FFFFFF"><%=Formatnumber((Rs2.Fields.Item("市值").Value),2)%></td>
<td align="right" bgcolor="#FFFFFF"><%=Formatnumber((Rs2.Fields.Item("增减").Value),2,-1)%></td>
<td align="center" bgcolor="#FFFFFF"><%=(Rs2.Fields.Item("天数").Value)%></td>
<td align="right" bgcolor="#FFFFFF"><%=Formatnumber((Rs2.Fields.Item("成本").Value),4,-1)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Rs2.MoveNext()
Wend
%>
...
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询