2011-07-06 64 views
1

我有下面的代碼,我想修改,以便TBODY可以有不THEAD移動滾動條:TBODY滾動條問題

<table class="sortable"> 
<thead border="0" cellspacing="0" cellpadding="2" align="left" style="position:relative; bottom:-3px; left:0px;"> 
<tr> 
<% 
For i = 0 to Ubound(hdVals) 
    if i = 0 then 
     response.Write "<td class=""symbollng"" valign=""bottom"" style=""border-right:0px; border-left:0px;"">" & hdVals(i) & "</td>" & vbnewline 
    elseif i = 1 then 
     response.Write "<td class=""close-hd"" valign=""bottom"">" & hdVals(i) & "</td>" & vbnewline 
    else 
     dstrVals(i-2,0) = hdVals(i) 
     response.Write "<td class=""col-hd-wd"" valign=""bottom"">" & hdVals(i) & "</td>" & vbnewline 
    end if 
Next 
%> 
</tr> 
</thead> 



<tbody class="scrollContent"> 
<% 
EO = "odd" 
For i = 1 to Ubound(tmpRows)-1 
    if EO = "odd" then 
     response.Write "<tr class=""grey"">" & vbnewline 
    else 
     response.Write "<tr>" & vbnewline 
    end if 
    tmpRowVals1 = split(tmpRows(i),"=") 
    tmpRowVals = split(tmpRowVals1(1),":") 
    For j = 0 to Ubound(tmpRowVals) 
     if j = 0 then 
      response.Write "<td class=""symbollng""><span title=""" & tmpRowVals(j) & """>" & tmpRowVals(j) & "</span></td>" & vbnewline 
     elseif j = 1 then 
      if trim(tmpRowVals(j)) = "" then 
       response.Write "<td class=""close"">&nbsp;</td>" & vbnewline 
      else 
       response.Write "<td class=""close""><span title=""" & tmpRowVals(j) & """>" & tmpRowVals(j) & "</span></td>" & vbnewline 
      end if 
     else 
      Call addToDistChart(j-2,tmpRowVals(j)) 
      gTime = hdVals(j) 
      response.Write getCellColorWithClick(curlv(tmpRowVals(j)),tmpRowVals(0),gSec,gChar,gTime) 
     end if 
    Next 
    response.Write "</tr>" & vbnewline 
    if EO = "odd" then 
     EO = "even" 
    else 
     EO = "odd" 
    end if 
Next 
%> 
</tbody> 
</table> 

下面是設計的一個畫面我至今爲表:

enter image description here

希望它在我的代碼編輯小,因爲處理表一直是痛苦:(

回答

0

找到了一個解決方案,它是一個jquery插件,用於格式化表格並自動檢測列中的值,從而可以對它們進行正確排序。它也產生可樣式根據自己的喜好一個漂亮的UI界面:

http://www.datatables.net/