完整的页面<!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" lang="en-US" xml:lang="en-US">
<head>
<title>OST test Code Coverage</title>
<link rel="stylesheet" type="text/css" href=".style1%20{font-family:%20Times%20New%20Roman,%20Times,%20serif}%20%20%20%20%20%20%20%20%20%20.style2%20{font-size:%2020pt}" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<h1 align="center"><a href='alltestCov.pl'>OST Test Code Coverage Report</a></h1><h3 align="center"><font color=blue>p1.rec.sql6A02</font> Test</h3><h3 align="center"><font color=blue>RS</font> Test Coverage</h3><form method="POST" action="--WEBBOT-SELF--">
<table align="center" bordercolor="#111111" border="0" id="CovList" style="border-collapse: collapse" cellspacing="0" cellpadding="0" height="496"><tr style='BACKGROUND-COLOR: #0000ff'>
  <th height='40' align='left' style='cursor:hand'> <u><font size='4' color='white' onclick='javascript:location.reload();'>DIR<br>  Name</font></u></th>
  <th height='40' align='center' style='cursor:hand' colspan='2'> <u><font size='4' color='white' onclick='sortTable(1)'>Block<br>  Coverage</font></u></th>
  <th height='40' align='center' style='cursor:hand' colspan='2'> <u><font size='4' color='white' onclick='sortTable(3)'>Code<br>  Coverage</font></u></th>
  <th height='40' align='center' style='cursor:hand' colspan='2'> <u><font size='4' color='white' onclick='sortTable(5)'>Function<br>  Coverage</font></u></th>
 </tr><tr>
  <td height=30 colspan=7>
      ======================================================================================
  </td>
  </tr><tr  style='BACKGROUND-COLOR: #FFFF88'>
    <td height='40' align='left'><b><a href='testDirCov.pl?test=p1.rec.sql6A02.export&dir=/calm/repl/svr/code/'>/calm/repl/svr/code/</a></b></td>
    <td height='40' align='right'>55%</td>
    <td align='center' height="40">
      <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
      <tr>
        <td width='55%' bgcolor='#008080'></td>
        <td width='45%'></td>
      </tr>
      </table>
    </td>
    <td height='40' align='right'>65%</td>
    <td align='center' height="40">
      <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
      <tr>
        <td width='65%' bgcolor='#008080'></td>
        <td width='35%'></td>
      </tr>
      </table>
    </td>
    <td height='40' align='right'>100%</td>
    <td align='center' height="40">
      <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
      <tr>
        <td bgcolor='#008080'></td>
      </tr>
      </table>
    </td>
    </tr> 
<tr  style='BACKGROUND-COLOR: #FFFFFF'>
    <td height='40' align='left'><b><a href='testDirCov.pl?test=p1.rec.sql6A02.export&dir=/calm/repl/svr/code/generic/cfg/'>/calm/repl/svr/code/generic/cfg/</a></b></td>
    <td height='40' align='right'>47%</td>
    <td align='center' height="40">
      <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
      <tr>
        <td width='47%' bgcolor='#008080'></td>
        <td width='53%'></td>
      </tr>
      </table>
    </td>
    <td height='40' align='right'>50%</td>
    <td align='center' height="40">
      <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
      <tr>
        <td width='50%' bgcolor='#008080'></td>
        <td width='50%'></td>
      </tr>
      </table>
    </td>
    <td height='40' align='right'>68%</td>
    <td align='center' height="40">
      <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
      <tr>
        <td width='68%' bgcolor='#008080'></td>
        <td width='32%'></td>
      </tr>
      </table>
    </td>
    </tr> 
<tr  style='BACKGROUND-COLOR: #99CCFF'>
    <td height='40' align='left'><b><a href='testDirCov.pl?test=p1.rec.sql6A02.export&dir=/calm/repl/svr/code/generic/dbg/'>/calm/repl/svr/code/generic/dbg/</a></b></td>
    <td height='40' align='right'>11%</td>
    <td align='center' height="40">
      <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
      <tr>
        <td width='11%' bgcolor='#008080'></td>
        <td width='89%'></td>
      </tr>
      </table>
    </td>
    <td height='40' align='right'>11%</td>
    <td align='center' height="40">
      <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
      <tr>
        <td width='11%' bgcolor='#008080'></td>
        <td width='89%'></td>
      </tr>
      </table>
    </td>
    <td height='40' align='right'>17%</td>
    <td align='center' height="40">
      <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
      <tr>
        <td width='17%' bgcolor='#008080'></td>
        <td width='83%'></td>
      </tr>
      </table>
    </td>
    </tr> 
<tr  style='BACKGROUND-COLOR: #FFFFFF'>
    <td height='40' align='left'><b><a href='testDirCov.pl?test=p1.rec.sql6A02.export&dir=/calm/repl/svr/code/generic/ddl/'>/calm/repl/svr/code/generic/ddl/</a></b></td>
    <td height='40' align='right'>22%</td>
    <td align='center' height="40">
      <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
      <tr>
        <td width='22%' bgcolor='#008080'></td>
        <td width='78%'></td>
      </tr>
      </table>
    </td>
    <td height='40' align='right'>21%</td>
    <td align='center' height="40">
      <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
      <tr>
        <td width='21%' bgcolor='#008080'></td>
        <td width='79%'></td>
      </tr>
      </table>
    </td>
    <td height='40' align='right'>37%</td>
    <td align='center' height="40">
      <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>

解决方案 »

  1.   

    <tr>
            <td width='37%' bgcolor='#008080'></td>
            <td width='63%'></td>
          </tr>
          </table>
        </td>
        </tr> 
    <tr  style='BACKGROUND-COLOR: #FFFF88'>
        <td height='40' align='left'><b><a href='testDirCov.pl?test=p1.rec.sql6A02.export&dir=/calm/repl/svr/code/generic/dsi/'>/calm/repl/svr/code/generic/dsi/</a></b></td>
        <td height='40' align='right'>26%</td>
        <td align='center' height="40">
          <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
          <tr>
            <td width='26%' bgcolor='#008080'></td>
            <td width='74%'></td>
          </tr>
          </table>
        </td>
        <td height='40' align='right'>41%</td>
        <td align='center' height="40">
          <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
          <tr>
            <td width='41%' bgcolor='#008080'></td>
            <td width='59%'></td>
          </tr>
          </table>
        </td>
        <td height='40' align='right'>55%</td>
        <td align='center' height="40">
          <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
          <tr>
            <td width='55%' bgcolor='#008080'></td>
            <td width='45%'></td>
          </tr>
          </table>
        </td>
        </tr> 
    <tr  style='BACKGROUND-COLOR: #FFFFFF'>
        <td height='40' align='left'><b><a href='testDirCov.pl?test=p1.rec.sql6A02.export&dir=/calm/repl/svr/code/generic/err/'>/calm/repl/svr/code/generic/err/</a></b></td>
        <td height='40' align='right'>44%</td>
        <td align='center' height="40">
          <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
          <tr>
            <td width='44%' bgcolor='#008080'></td>
            <td width='56%'></td>
          </tr>
          </table>
        </td>
        <td height='40' align='right'>51%</td>
        <td align='center' height="40">
          <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
          <tr>
            <td width='51%' bgcolor='#008080'></td>
            <td width='49%'></td>
          </tr>
          </table>
        </td>
        <td height='40' align='right'>75%</td>
        <td align='center' height="40">
          <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
          <tr>
            <td width='75%' bgcolor='#008080'></td>
            <td width='25%'></td>
          </tr>
          </table>
        </td>
        </tr> 
    <tr  style='BACKGROUND-COLOR: #99CCFF'>
        <td height='40' align='left'><b><a href='testDirCov.pl?test=p1.rec.sql6A02.export&dir=/calm/repl/svr/code/generic/exc/'>/calm/repl/svr/code/generic/exc/</a></b></td>
        <td height='40' align='right'>40%</td>
        <td align='center' height="40">
          <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
          <tr>
            <td width='40%' bgcolor='#008080'></td>
            <td width='60%'></td>
          </tr>
          </table>
        </td>
        <td height='40' align='right'>54%</td>
        <td align='center' height="40">
          <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
          <tr>
            <td width='54%' bgcolor='#008080'></td>
            <td width='46%'></td>
          </tr>
          </table>
        </td>
        <td height='40' align='right'>75%</td>
        <td align='center' height="40">
          <table border='1' style='border-collapse: collapse' bordercolor='#FF1111'  width='50' height='15'>
          <tr>
            <td width='75%' bgcolor='#008080'></td>
            <td width='25%'></td>
          </tr>
          </table>
        </td>
        </tr> 
    <tr>
      <td height=30 colspan=7>
          ======================================================================================
      </td>
      </tr></table></form><script language='JavaScript'>function sortTable(col) 
    {
    var i;
    var theRows=new Array();
      //var CovList =  document.getElementById('CovList');
      for(i=0;i<CovList.rows.length-3;i++) 
    {
      if(CovList.rows[i+2].cells[0].innerText == "")
    {
    continue;
    }
    var colstr = CovList.rows[i+2].cells[col].innerText ;
        colstr = colstr.replace(/%/,'0');
    theRows[i]=new Array(colstr,CovList.rows[i+2].outerHTML);
    }
    theRows.sort(sortRows);

      var head='';
      head = "<table align='center' bordercolor='#111111' border='0' id='CovList' style='border-collapse: collapse' cellspacing='0' cellpadding='0'> " ;
      head = head + CovList.rows[0].outerHTML + CovList.rows[1].outerHTML ;
        
      var tail='' ;
      tail = CovList.rows[CovList.rows.length-1].outerHTML ;
      tail = tail + '</table>' ;
      
      var str='';
      
    for(i=0;i<theRows.length;i++)
    {
    str+=theRows[i][1];
    } CovList.outerHTML=head+str+tail ;

    bgcolor = new Array("#FFFF88","#FFFFFF","#99CCFF","#FFFFFF") ;
      for(i=0;i<theRows.length;i++)
      {
        CovList.rows[i+2].style.backgroundColor=bgcolor[i%4] ;
      }
    return ;
    }
    function sortRows(x,y)
    {
      return (x[0]-y[0]) ;
    }
    </script></body>
    </html>
      

  2.   

    pli0825(紫飞絮), 排序后页面的颜色乱了, CovList.rows[i+2].style.backgroundColor=bgcolor[i%4] ;
    为什么不对阿这么多代码不用看的阿, copy下来就可以演示, 是为了把问题交代清楚
      

  3.   

    没有排序的时候颜色是间隔开的,黄-白-蓝-白, 排序后颜色就不是这样排列的了, 所以我才用下面的语句重新调整颜色啊, 但是这些语句没有起作用,就是循环内的那个有错误,帮忙再看看bgcolor = new Array("#FFFF88","#FFFFFF","#99CCFF","#FFFFFF") ;
    for(i=0;i<theRows.length;i++)
    {
        CovList.rows[i+2].style.backgroundColor=bgcolor[i%4] ;
    }
      

  4.   

    I would like to close this note, because I figured it out with the help of my friend.solution:
    get
      

  5.   

    回复人: pli0825(紫飞絮) ( ) 信誉:100  2006-01-11 09:10:00  得分: 0  
     
     
       我看了下,排序颜色没有乱。挺好的。排序时背景颜色也跟着相应调整了。两行白色的在一起,是因为你初始化的时候就给他们分配的底色是白色的,
    排序后又正好排在一起的原因啊。
      
     
    有么?你点的什么排序?
      

  6.   

    I  would  like  to  close  this  note,  because  I  figured  it  out  with  the  help  of  my  friend.  
     
    solution:  
    get the table again after re-created it.CovList.outerHTML =head+str+tail ;
    CovList =  document.getElementById('CovList');after CovList.outerHTML=head+str+tail ;  the table 'CovList' is a new one , the previous Covlist has been destroyed, So I should get it again.Thanks everyone who pay attention to this issue.