日期:2014-05-17  浏览次数:20643 次

简单的table,难以控制的宽度,请教!保证是您以前没有遇到的问题。
项目中遇到了这个对不齐的table,我是做表头固定用的,抓取真表的表头部分的代码,生成一个新的table,用于悬浮在真的表头之上,到达固定表头的目的,可是生成的新表与真实的表列的宽度不一致,请高手解决,70分不够可以再加。

谢谢高手们,下面是下载代码的链接,我已经把代码整理好了,下载就能运行。下载!
http://download.csdn.net/detail/dystocia/4432595

------解决方案--------------------
有改过来。不过有些细微的没调节完。。快下班了先贴出来吧!
HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="default.css" rel="stylesheet" type="text/css" />
<script src="jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="GridHelper.js" type="text/javascript"></script>
<style> 
</style>
</head>
<body>
<div id="DivBody" class="DivBodyScroll" style="width: 1220px; height: 692px;">
  <table class="Grid" cellspacing="0" rules="all" border="1" id="GridView1" style="border-collapse: collapse;">
    <thead>
      <tr class="GridHeader">
        <th class="GridHeader" align="center" rowspan="2"> 标识 </th>
        <th class="GridHeader" align="center" colspan="3"> 日期 </th>
        <th class="GridHeader" align="center" rowspan="2"> 品名 </th>
        <th class="GridHeader" align="center" rowspan="2"> 规格 </th>
        <th class="GridHeader" align="center" rowspan="2"> 销量 </th>
        <th class="GridHeader" align="center" colspan="3"> 本期 </th>
        <th class="GridHeader" align="center" rowspan="2"> 毛2利率 </th>
        <th class="GridHeader" align="center" colspan="3"> 毛利率 </th>
        <th class="GridHeader" align="center" rowspan="2"> 销量同比增长率 </th>
        <th class="GridHeader" align="center" rowspan="2"> 销售同比增长率 </th>
        <th class="GridHeader" align="center" rowspan="2"> 毛利同比增长率 </th>
        <th class="GridHeader" align="center" rowspan="2"> 销量环比增长率 </th>
        <th class="GridHeader" align="center" rowspan="2"> 销售环比增长率 </th>
        <th class="GridHeader" align="center" rowspan="2"> 毛利环比增长率 </th>
      </tr>
      <tr>
        <th class="GridHeader" align="center" tdindex="1"> 年度 </th>
        <th class="GridHeader" align="center" tdindex="2"> 季度 </th>
        <th class="GridHeader" align="center" tdindex="3"> 月度 </th>
        <th class="GridHeader" align="center" tdindex="7"> 成本 </th>
        <th class="GridHeader" align="center" tdindex="8"> 佣金 </th>
        <th class="GridHeader" align="center" tdindex="9"> 销售 </th>
        <th class="GridHeader" align="center" tdindex="11"> 本期 </th>
        <th class="GridHeader" align="center" tdindex="12"> 同期 </th>
        <th class="GridHeader" align="center" tdindex="13"> 差异 </th>
        <!--<th class="GridHeader"